Me mode: make init reap zombie processes
This commit is contained in:
parent
4c9c70e763
commit
b67ea2272f
9
pid.c
9
pid.c
@ -47,9 +47,12 @@ bool pidInitNs(struct nsjconf_t *nsjconf)
|
|||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
return true;
|
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");
|
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 */
|
/* Act sort-a like a init by reaping zombie processes */
|
||||||
struct sigaction sa = {
|
struct sigaction sa = {
|
||||||
@ -58,8 +61,8 @@ bool pidInitNs(struct nsjconf_t *nsjconf)
|
|||||||
.sa_restorer = NULL,
|
.sa_restorer = NULL,
|
||||||
};
|
};
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
if (sigaction(SIGSTOP, &sa, NULL) == -1) {
|
if (sigaction(SIGCHLD, &sa, NULL) == -1) {
|
||||||
PLOG_W("Couldn't set sighandler for SIGSTOP");
|
PLOG_W("Couldn't set sighandler for SIGCHLD");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
Loading…
Reference in New Issue
Block a user