[gccsdk] fork() call failing

Ron beeb at woosh.co.nz
Mon May 17 04:18:13 PDT 2010

While having no problem calling fork() from small demo programs,
it allways fails when being called from within the execsh() 
function. (unix mk program)
I can call system(), which uses fork(), I read somewhere.
I can use vfork(), but it is has functional differences which
are hard to get around, like it cannot return to
the caller of execsh().
At the end of execsh() is 

return pid

With  pid = fork,  pid can be either 0 or the child process ID,
depending on which process is looking at pid.
This doesn't happen with vfork().

I'm just wondering if there are any known problems with fork().
I noticed that calling system() after fork() upsets one process
from doing it's job also, though this isn't a requirement.

Ron M

More information about the gcc mailing list