[PATCH v2] test-skeleton: Kill any child process's offspring
Roland McGrath
roland@hack.frob.com
Mon Jun 23 17:34:00 GMT 2014
I don't know what you did to test that change. I can't see how it could
possibly work as intended. You've changed the value of PID in the child,
but it's only actually used in the parent (where it won't have changed).
Am I missing something?
Without more futzing than is worthwhile, there is no way that the child can
communicate back to the parent whether setpgid succeeded or failed. The
error message is nice to have, but I don't think the parent actually needs
to care whether setpgid worked or not. If it didn't, there won't be any
pgrp with pgid -pid.
So I think all you really need is to make the handler do:
assert (pid > 1);
/* Kill the whole process group. */
kill (-pid, SIGKILL);
/* In case, setpgid failed in the child, kill it individually too. */
kill (pid, SIGKILL);
Thanks,
Roland
More information about the Libc-alpha
mailing list