This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] test-skeleton: Kill any child process's offspring


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]