Commit f3304a29 by Ferenc Wagner Committed by Daniel Lezcano

forward signals to the container init

parent d1c383f3
...@@ -195,13 +195,13 @@ static int setup_sigchld_fd(sigset_t *oldmask) ...@@ -195,13 +195,13 @@ static int setup_sigchld_fd(sigset_t *oldmask)
sigset_t mask; sigset_t mask;
int fd; int fd;
if (sigprocmask(SIG_BLOCK, NULL, &mask)) { /* Block everything except serious error signals */
SYSERROR("failed to get mask signal"); if (sigfillset(&mask) ||
return -1; sigdelset(&mask, SIGILL) ||
} sigdelset(&mask, SIGSEGV) ||
sigdelset(&mask, SIGBUS) ||
if (sigaddset(&mask, SIGCHLD) || sigprocmask(SIG_BLOCK, &mask, oldmask)) { sigprocmask(SIG_BLOCK, &mask, oldmask)) {
SYSERROR("failed to set mask signal"); SYSERROR("failed to set signal mask");
return -1; return -1;
} }
...@@ -231,7 +231,7 @@ static int sigchld_handler(int fd, void *data, ...@@ -231,7 +231,7 @@ static int sigchld_handler(int fd, void *data,
ret = read(fd, &siginfo, sizeof(siginfo)); ret = read(fd, &siginfo, sizeof(siginfo));
if (ret < 0) { if (ret < 0) {
ERROR("failed to read sigchld info"); ERROR("failed to read signal info");
return -1; return -1;
} }
...@@ -240,6 +240,12 @@ static int sigchld_handler(int fd, void *data, ...@@ -240,6 +240,12 @@ static int sigchld_handler(int fd, void *data,
return -1; return -1;
} }
if (siginfo.ssi_signo != SIGCHLD) {
kill(*pid, siginfo.ssi_signo);
INFO("forwarded signal %d to pid %d", siginfo.ssi_signo, *pid);
return 0;
}
if (siginfo.ssi_code == CLD_STOPPED || if (siginfo.ssi_code == CLD_STOPPED ||
siginfo.ssi_code == CLD_CONTINUED) { siginfo.ssi_code == CLD_CONTINUED) {
INFO("container init process was stopped/continued"); INFO("container init process was stopped/continued");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment