Mailinglist Archive: opensuse-programming (6 mails)

< Previous Next >
Re: [opensuse-programming] waitpid() failed; error 10: No child processes
  • From: Per Jessen <per@xxxxxxxxxxxx>
  • Date: Sun, 26 Jul 2009 14:19:11 +0200
  • Message-id: <h4hhjv$oiu$1@xxxxxxxxxxxxxxxx>
Jerry Feldman wrote:

On 07/26/2009 05:52 AM, Per Jessen wrote:
I'm forking a process, then waiting to pick it up with

waitpid(-1,0,WNOHANG)

but waitpid() returns -1 and error 10: No child processes ??

I suspect this may be somehow system/kernel dependent, coz' I have
such code in a few places and it has always worked just fine, i.e.
returned 0 when no child existed or had exited.

I have a SIGCHLD signal handler, which just increments a counter.
When the counter is >0, I call waitpid().

I obviously googled this, and came across a few hits, but nothing
really useful.

I'm pretty sure that waitpid() will return -1 if executed after your
signal handler.

Yeah, I think you're right - I've been going over my old code, and I
have a check for errno!=ECHILD.


/Per Jessen, Z├╝rich

--
To unsubscribe, e-mail: opensuse-programming+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-programming+help@xxxxxxxxxxxx

< Previous Next >
List Navigation