From 49eb95319e878832cb3d6aa51a63d08d6b1b36b7 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 4 Mar 2019 17:07:23 +0100 Subject: [socket] Make use of official monitor to term function Remove own function to make monitor printable (was a hack) and make use of the new enif_make_monitor_term instead. --- erts/emulator/nifs/common/socket_int.h | 1 + erts/emulator/nifs/common/socket_nif.c | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/erts/emulator/nifs/common/socket_int.h b/erts/emulator/nifs/common/socket_int.h index 5fe590fa7a..58e0645691 100644 --- a/erts/emulator/nifs/common/socket_int.h +++ b/erts/emulator/nifs/common/socket_int.h @@ -357,6 +357,7 @@ GLOBAL_ERROR_REASON_ATOM_DEFS #define MONP(S,E,D,P,M) esock_monitor((S), (E), (D), (P), (M)) #define DEMONP(S,E,D,M) esock_demonitor((S), (E), (D), (M)) #define MON_INIT(M) esock_monitor_init((M)) +#define MON2T(E, M) enif_make_monitor_term((E), (M)) // #define MON_COMP(M1, M2) esock_monitor_compare((M1), (M2)) #define COMPARE(A, B) enif_compare((A), (B)) diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c index cd51a5fcbd..2d8dc3c201 100644 --- a/erts/emulator/nifs/common/socket_nif.c +++ b/erts/emulator/nifs/common/socket_nif.c @@ -32,7 +32,7 @@ * * esock_dbg_printf("DEMONP", "[%d] %s: %T\r\n", * descP->sock, slogan, - * my_make_monitor_term(env, &monP->mon)); + * MON2T(env, &monP->mon)); * */ @@ -17309,12 +17309,6 @@ void cnt_dec(Uint32* cnt, Uint32 dec) #if !defined(__WIN32__) -static -ERL_NIF_TERM my_make_monitor_term(ErlNifEnv* env, const ErlNifMonitor* mon) -{ - return ((ERL_NIF_TERM)&mon->data) + 2; -} - static int esock_monitor(const char* slogan, ErlNifEnv* env, @@ -17858,7 +17852,7 @@ void socket_down(ErlNifEnv* env, "\r\n Descriptor: %d" "\r\n Monitor: %T" "\r\n", sres, pid, descP->sock, - my_make_monitor_term(env, mon)); + MON2T(env, mon)); } } else { -- cgit v1.2.3