[ns_exec] Add SIGCHLD to default clone flags
Serge E. Hallyn
serue at us.ibm.com
Fri Jul 10 10:58:51 PDT 2009
Quoting Oren Laadan (orenl at cs.columbia.edu):
> This is the default behavior. Without it, the process will not
> report/be reported to the parent on a normal wait() call. Instead
> the parent will need to use __WALL wait flag.
> This caused a nasty bug where running 'rstr' from a checkpoint
> image of a process executed with ns_exec would cause the shell
> to skip to the next line in the script without waiting for the
> restarted task to terminate, contrary to one's expectation.
> TODO: if someone would like to run with anything else than the
> SIGCHLD there, then add an option to ns_exec to allow it.
Thanks Oren. Since this flags field is also used for the
unshare path, this would actually make that fail. So instead
of taking this patch, I'm currently unconditionally ORing in
SIGCHLD right before calling clone.
If someone ends up wanting to send something other than SIGCHLD
we'll worry about it when they send a patch I think :)
> diff --git a/ns_exec.c b/ns_exec.c
> index 3c3aa9e..0d2f54a 100644
> --- a/ns_exec.c
> +++ b/ns_exec.c
> @@ -219,7 +219,7 @@ void write_pid(char *pid_file, int pid)
> int main(int argc, char *argv)
> int c;
> - unsigned long flags = 0, eflags = 0;
> + unsigned long flags = SIGCHLD, eflags = 0;
> char ttyname;
> int status;
> int ret, use_clone = 0;
More information about the Containers