-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matt Sergeant writes:
> On 11 Jul 2005, at 11:43, Robert Spier wrote:
> 
> >> Anyone have any thoughts on how to solve this? Can you tell waitpid()
> >> to only operate on child processes and not grandchild processes?
> >
> > No, but you can tell it to only wait for a specific pid.  But that
> > won't help in this case.
> 
> Ah actually I think the bug was slightly different to what I thought I 
> was seeing.
> 
> When qmail-queue doesn't exist, the exec fails, and the parent can end 
> up sat trying to wait to write onto the message pipe. A simple check 
> for if(eof(PIPE)) fixes it, though there's still a race there because 
> of the blocking nature of the write.
> 
> This could also be specific to Mac pipes - I wonder if the write will 
> fail on Linux if the process has exited.

you'd get a SIGPIPE iirc.  I think that's POSIX standard.

also, a possible solution to the grandchild problem, if it's still
an issue, is to shift off the children into their own process groups
using POSIX::setpgrp() or POSIX::setpgid(), if available.

- --j.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFC0r6MMJF5cimLx9ARAvL9AJwNeWJmO/pDXoY/2c8UT+18nEj8MwCfQa3e
7na2eJ42kKd0bpEVZkzzlbg=
=S3Fu
-----END PGP SIGNATURE-----

Reply via email to