"Erich Lin" <dmatrix00d / gmail.com> writes:

> I meant taht I would call a parent process to open, which is some
> program.  And that program can POTENTIALLY open up other children
> processes.  The thing is I only have the pid of the parent, and when
> I kill the parent, only the parent will die.  Is there a way that I
> can kill the parent and the children that it sprang (which I did not
> provide the exec code for since they were provided by the parent
> itself that I did not code).

I don't think you can do this in the general case on Unix unless you
use ptrace(), which you really don't want to do.  A process can only
know its immediate children.  If you call setsid() in the child after
the fork(), and if the program you exec() doesn't do any
session-management calls (setsid(), setpgrp()) itself, then it will
probably work to call 'kill(-N, SIGTERM)' where N is the PID of your
child process (which is the parent of the other processes).  If the
program you're calling does setsid() or setpgrp() on its own, you will
probably lose.

This session and process group stuff will bend your brain--it's not
simple at all.  I have no idea whether you can do what you're looking
for on Windows, though you might be able to using the POSIX
extensions.

-Doug