Re: waitpid problems: new insights ...

Eberhard Mattes <[email protected]> 26 Sep 2003 10:38:55 +0200
Newsgroups gmane.comp.ide.emx.devel
Message-ID <[email protected]>
Thomas Hoffmann wrote:

> After some days of struggling with this problem, I found out that the 
> reason was my attempt to handle a child process created via 
> system("bla") with waitpid().

You can't use waitpid() with system() as system() returns the status.

> Do YOU have ideas how one could work around this?

Block SIGCLD before calling system(), unblock after.

system() should do that itself.

BTW, I think the Unix which has level-triggered SIGCLD is System V.
With edge-triggered SIGCLD, you don't need waitpid() in the signal
handler.

Eberhard