aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-12-15 18:07:13 +0100
committerBjörn-Egil Dahlberg <[email protected]>2017-01-19 14:24:47 +0100
commit40c82769def0cfa59e75669ff1c6fc4abcecd764 (patch)
treeba1f6bd4c8b92b0270d91b3843bf8bf82b8786fd /erts
parenta7b52ad679e6a58a9351a26e198eee70067b000f (diff)
downloadotp-40c82769def0cfa59e75669ff1c6fc4abcecd764.tar.gz
otp-40c82769def0cfa59e75669ff1c6fc4abcecd764.tar.bz2
otp-40c82769def0cfa59e75669ff1c6fc4abcecd764.zip
erts: Handle SIGTERM via signal service instead
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/atom.names1
-rw-r--r--erts/emulator/sys/unix/sys.c28
2 files changed, 5 insertions, 24 deletions
diff --git a/erts/emulator/beam/atom.names b/erts/emulator/beam/atom.names
index 363b17e27c..52a3413796 100644
--- a/erts/emulator/beam/atom.names
+++ b/erts/emulator/beam/atom.names
@@ -592,6 +592,7 @@ atom set_tcw_fake
atom separate
atom shared
atom sighup
+atom sigterm
atom silent
atom size
atom sl_alloc
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();