Me mode: make init reap zombie processes

This commit is contained in:
Robert Swiecki 2017-06-14 02:19:03 +02:00
parent 4c9c70e763
commit b67ea2272f

9
pid.c
View File

@ -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 (;;) {