On Thu, 18 Apr 2002, Gregory Hosler wrote:

> On 17-Apr-02 Bill Crawford wrote:
...
> >  Unless the signal handler for SIGCHLD is set to SIG_IGN ...
> 
> the code in question infact sets the signal handler to SIG_IGN, which is what
> is allowing the loss of the exit status when the fork/exec'd process completes
> before the fork returns. (and yes, I have verified, that depending upon alot of
> things, it is actually possible, and not even rare, for fork/exec to run to
> completion before the parent fork() returns).

 Yeah, I just coded up a fork-and-exit with the parent sleep()ing for
a few seconds and the default signal handling behaviour is fine (i.e.
if you set it back to SIG_DFL it works as desired).

 If it's possible, just leave the handler as SIG_DFL, the default is
to ignore it anyway (but doesn't give you the problem of losing the
exit status).  Then you just do the wait() or waitpid() as required.
You only need to rely on SIGCHLD for asynchronous notification; you
already know the pid and you're expecting it to exit, so you don't
need the signal at all, you just want to reap the process.

> -Greg




_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to