Quoth Philip Hazel on Thu, May 27, 1999:
> I have investigated the two suggestions. It turns out the process groups
> are a red herring because a process can only wait for its immediate
> children (even using a process group id instead of an explicit pid), not
> its grandchildren or remoter generations.
Oops... Well, maybe you will want to see how the shells use the
process groups. I'll try to look at the sources, but I'm no
guru, so I don't promise anything.
> However, doing the pipe trick is indeed simple and works well. I just
> had to make sure it didn't get closed by mistake. I have in fact just
> written a read() rather than a select() - it blocks until the pipe
> vanishes. If there's a guru who knows why this is wrong, please let me
> know.
It's not wrong. You can use read(2), but I suggested select(2)
because I thought that maybe you would want to sleep on more than
one file descriptor. If you need only one, read(2) is perfect.
Yeah, and read(2) is cleaner, simpler, and probably more portable
than select(2) (for example, FD_ALLOC doesn't exist on SunOS).
The side effect is that you can return an OK information through
the pipe on a normal exit, and assume murder if the pipe is just
closed and you read zero bytes (EOF). But I don't think this
information is important.
Vadik.
--
Do not meddle in the affairs of sysadmins, they are quick to
anger and have no need for subtlety.
--
*** Exim information can be found at
http://www.exim.org/ ***