That isn't good enough for Windows
but that's a separate issue. (We need
to have some kind of Process abstraction
to make Wait etc work on Windows.)
Russ
It's worse than you think (it usually is).
If the child may have children if its own, then KILLing the parent
might not stop them. You have to create a new process group (setpgrp)
after you fork and KILL the whole group (with kill(2) and a negative
PID argument).
Also, signal(7) says that the default disposition of SIGCHLD is
Ignore. However, POSIX 2001 says that you cannot wait on children if
you ignore SIGCHLD. And, if you don't wait on children then you'll end
up with zombies. Also, there's no timed wait/waitpid, you have to use
NOHANG in a loop. Also, you can race the kernel between seeing EOF on
a child's fd, or getting SIGCHLD, and calling waitpid with NOHANG.
Different UNIXs may, of course, differ. Even assuming that all the
above is correct!
AGL
syscall.Kill?
-rob