]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
make container to die when parent dies
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 7 Oct 2009 14:06:09 +0000 (16:06 +0200)
commit6a6ad7af58ba541ea27300fdd05715ef9454ce8e
treedbe47d734ff1c590eea2c5d1361399ab373e47d7
parenta9e61274bc2c316c4dbded00d9b75ff6419f42d6
make container to die when parent dies

When the parent of the first process dies, the container stays there
making very difficuly to track it and to kill. We have to use the
lxc-ps --lxc and kill the processes, hoping we kill the init process
of the container. That's not a big deal until we have thousand of
processes in the container :)

We want to keep the parent of the container init always there, this
process is responsible to manage the container, provide tty, notify
the container changing states and ensure self exclusion (eg. avoid
to launch several containers with the same name).

If this process dies, we consider that as a fatal error and we make
the child process to die too. This patch will just add the prctl to
to send a SIGKILL to the container init process when its parent exits
For the point of view of the pid namespace, when the init process dies
all the processes of the namespace are killed too.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/start.c