Merge pull request #530 from hqhq/hq_add_nsexec_comment

add comments for nsexec.c
This commit is contained in:
Mrunal Patel 2015-04-14 08:17:54 -07:00
commit 2afcf7c77c
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,8 @@ void nsexec()
} }
if (setjmp(env) == 1) { if (setjmp(env) == 1) {
// Child
if (setsid() == -1) { if (setsid() == -1) {
pr_perror("setsid failed"); pr_perror("setsid failed");
exit(1); exit(1);
@ -162,7 +164,11 @@ void nsexec()
// Finish executing, let the Go runtime take over. // Finish executing, let the Go runtime take over.
return; 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); child = clone_parent(&env);
if (child < 0) { if (child < 0) {
pr_perror("Unable to fork"); pr_perror("Unable to fork");