add comments for nsexec.c

It would be easier for people to understand how nsexec really
works.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2015-04-14 13:55:04 +08:00
parent 1f91f6564d
commit 9ce88b829f
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,8 @@ void nsexec()
}
if (setjmp(env) == 1) {
// Child
if (setsid() == -1) {
pr_perror("setsid failed");
exit(1);
@ -162,7 +164,11 @@ void nsexec()
// Finish executing, let the Go runtime take over.
return;
}
// Parent
// We must fork to actually enter the PID namespace, use CLONE_PARENT
// so the child can have the right parent, and we don't need to forward
// the child's exit code or resend its death signal.
child = clone_parent(&env);
if (child < 0) {
pr_perror("Unable to fork");