From bb357be604b64d489b6015f4c7466be51a748929 Mon Sep 17 00:00:00 2001 From: turret Date: Sun, 14 Jan 2024 19:50:24 -0600 Subject: init: modify panic termination sequence in log: we ensure we panic by killing our process group with SIGTERM, raising it for ourselves, and exiting (if all else fails simply). in init: we catch SIGTERM and exit with 0 if we get it, as bash (and likely others) prints a nasty "Terminated" to stderr --- init/init.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'init/init.c') diff --git a/init/init.c b/init/init.c index ecd3c25..5387043 100644 --- a/init/init.c +++ b/init/init.c @@ -103,6 +103,7 @@ int main(void) static sigset_t set; sigaddset(&set, SIGCHLD); sigaddset(&set, SIGINT); + sigaddset(&set, SIGTERM); sigprocmask(SIG_BLOCK, &set, NULL); while(subsystem_count > 0) { @@ -119,6 +120,8 @@ int main(void) } } else if(sig == SIGINT) { panic("init: keyboard interrupt"); + } else if(sig == SIGTERM) { + exit(0); } } -- cgit v1.2.3