On 15:02 16 Apr 2002, Gregory Hosler <[EMAIL PROTECTED]> wrote:
| scenerio: program forks/execv's another task, then does a waitpid() to reap the
| exit status.
[...]
| with today's faster cpu's, [...] it is
| actually quite possible for the forked/execv'd program to start and run to
| completion _before_ the parent process issues the waitpid(). WHen that happens,
| the waitpid() returns an ECHILD error, and the exit return status is lost.

You've verified this? I would not have expected such misbehaviour.
Wait() and waitpid(0 _should_ return with the correct exit status -
that is the purpose of leaving zombies around - to hold such status
after program exit until wait() or waitpid() collects it.

The manual page bears me out on this too.

Are you _sure_ you haven't inadvertantly collected the status with another
wait() call by accident? Remember that the status can only be collected
once, but it should certainly work just fine after the child has exit()ed.

You should NOT need signals to handle this situation.  Signals are very
prone to racings if misused, and to be avoided when possible.
-- 
Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

I am a Bear of Very Little Brain and long words Bother Me.
        - Winnie-the-Pooh



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

Reply via email to