From 40c82769def0cfa59e75669ff1c6fc4abcecd764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 15 Dec 2016 18:07:13 +0100 Subject: erts: Handle SIGTERM via signal service instead --- erts/emulator/sys/unix/sys.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'erts/emulator/sys') diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index a099662b16..cb9ed2de76 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -679,26 +679,6 @@ static RETSIGTYPE request_break(int signum) #endif } -static void stop_requested(void) { - Process* p = NULL; - Eterm msg, *hp; - ErtsProcLocks locks = 0; - ErlOffHeap *ohp; - Eterm id = erts_whereis_name_to_id(NULL, am_init); - - if ((p = (erts_pid2proc_opt(NULL, 0, id, 0, ERTS_P2P_FLG_INC_REFC))) != NULL) { - ErtsMessage *msgp = erts_alloc_message_heap(p, &locks, 3, &hp, &ohp); - - /* init ! {stop,stop} */ - msg = TUPLE2(hp, am_stop, am_stop); - erts_queue_message(p, locks, msgp, msg, am_system); - - if (locks) - erts_smp_proc_unlock(p, locks); - erts_proc_dec_refc(p); - } -} - #if (defined(SIG_SIGSET) || defined(SIG_SIGNAL)) static RETSIGTYPE request_stop(void) #else @@ -706,9 +686,9 @@ static RETSIGTYPE request_stop(int signum) #endif { #ifdef ERTS_SMP - smp_sig_notify('S'); + smp_sig_notify('T'); #else - stop_requested(); + signal_notify_requested(am_sigterm); #endif } @@ -1330,8 +1310,8 @@ signal_dispatcher_thread_func(void *unused) case 'H': /* SIGHUP */ signal_notify_requested(am_sighup); break; - case 'S': /* SIGTERM */ - stop_requested(); + case 'T': /* SIGTERM */ + signal_notify_requested(am_sigterm); break; case 'I': /* SIGINT */ break_requested(); -- cgit v1.2.3