lxc-init kills all processes with SIGTERM

When lxc-init receives a SIGTERM, let's kill all the processes of
the pid namespace with kill -1. So the exit of the container will
happen gracefully with processes death cascade.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Daniel Lezcano 2010-07-13 14:51:45 +02:00
parent 83ee787579
commit 6fd1668e7f

View File

@ -154,11 +154,21 @@ int main(int argc, char *argv[])
int orphan = 0;
pid_t waited_pid;
if (was_interrupted) {
switch (was_interrupted) {
case 0:
break;
case SIGTERM:
kill(-1, SIGTERM);
break;
default:
kill(pid, was_interrupted);
was_interrupted = 0;
break;
}
was_interrupted = 0;
waited_pid = wait(&status);
if (waited_pid < 0) {
if (errno == ECHILD)