Me mode: make init reap zombie processes
authorRobert Swiecki <robert@swiecki.net>
Wed, 14 Jun 2017 00:19:03 +0000 (02:19 +0200)
committerRobert Swiecki <robert@swiecki.net>
Wed, 14 Jun 2017 00:19:03 +0000 (02:19 +0200)
pid.c

diff --git a/pid.c b/pid.c
index 25694d6af85844ff44bfbe94e08e806e47baab03..d4186fe3b798c2d8e70c25edcf96b3abb48bbbf3 100644 (file)
--- a/pid.c
+++ b/pid.c
@@ -47,9 +47,12 @@ bool pidInitNs(struct nsjconf_t *nsjconf)
        if (pid > 0) {
                return true;
        }
-       if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0) == -1) {
+       if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0UL, 0UL, 0UL) == -1) {
                PLOG_W("(prctl(PR_SET_PDEATHSIG, SIGKILL) failed");
        }
+       if (prctl(PR_SET_NAME, "init", 0UL, 0UL, 0UL) == -1) {
+               PLOG_W("(prctl(PR_SET_NAME, 'init') failed");
+       }
 
        /* Act sort-a like a init by reaping zombie processes */
        struct sigaction sa = {
@@ -58,8 +61,8 @@ bool pidInitNs(struct nsjconf_t *nsjconf)
                .sa_restorer = NULL,
        };
        sigemptyset(&sa.sa_mask);
-       if (sigaction(SIGSTOP, &sa, NULL) == -1) {
-               PLOG_W("Couldn't set sighandler for SIGSTOP");
+       if (sigaction(SIGCHLD, &sa, NULL) == -1) {
+               PLOG_W("Couldn't set sighandler for SIGCHLD");
        }
 
        for (;;) {