[Asterisk-Users] Re: System called seems forked up

andrewg at felinemenace.org andrewg at felinemenace.org
Sat Feb 21 07:57:46 MST 2004


On Sat, Feb 21, 2004 at 09:41:52AM -0500, Bill Michaelson wrote:
> >It is now indeed more discerning, but it has reported Fork failed.  But 
> >the fork most certainly has not failed!  The shell command invoked has 
> >run, and what's more, completed successfully, producing the expected files.
> 
> >Does anyone have any ideas?
> 
> andrewg at felinemenace.org suggested:
> 
> Can you check the errno? strerror(errno); should give you a string of why  
> it
> failed. (Just be careful not to use other stuff which touches errno after 
> the
> fork()
> 
> 
> Of course - very good suggestion (embarrassed I didn't think of it)... 
> anyway...
> 
> it returns 10, which perror tells me is "No child processes".
> 
> Sooo, I suppose the spawned process is somehow disassociated from the 
> process group prior to execution of the wait() embedded within the 
> system()?  Duuh... I'm still stumped, but I guess we are on to something?
> 
> On the other hand, if a fork does really fail, one might expect errno to 
> be 10 in that case too.
> 
> I've half a mind to break it out into a fork/exec/wait for myself, but, 
> uh, ugh.  I guess I'm lazy.  Please, briliant insights, anybody?
> 

Checking the kernel source for sys_wait4, it would appear the child has already
disappeared (*shrug* not much of a kernel coder btw).

What is the status of SIGCHLD? if its being ignored the child will be reaped 
straight away iirc. if its not, I guess it should still be around for wait4'ing.

Probably for reliablity and portability, your own fork/exec/wait would be better
I would imagine.

- andrewg



More information about the asterisk-users mailing list