[gccsdk] fork/exec problems

Ron beeb at woosh.co.nz
Mon May 7 01:50:38 PDT 2012

In message <77ebe08b52.beeb at ron1954.woosh.co.nz>
          Ron <beeb at woosh.co.nz> wrote:

> I appreciate Duncan's  bug report on fork/exec as I am having problems.
> The latest release 4.1.2 (upgraded last night) reliably halts with
> segmentation error.
> Actually previous releases have been giving more erratic faults only 
> sometimes crashing at the some spot further into the program after
> returning from the fork.
> In the case of Tar, simply replacing fork with vfork or setting
> Tar$heap "" doesn't work, though I think in the long term, I'll have
> to change the code so it will work with vfork.
> The fork/exec is only doing a bit of file renaming for multipart tars,
> so shouldn't need a full copy of the parent.
I have vfork() working with the execv command now and straight away
it looks like any problem is gone.

I was changing fork() to vfork() in a place that affected all fork()'s
in the program and that did not work.
It looks like the fork()/execv combination was the main problem. 

I notice now I'm using vfork()/execv that the application task size
does not grow, and it stays at the allocated wimpslot size.
With fork()/execv, about 740K was added to the displayed task size
each time that routine was called. The older 4.1.2 would allow this
to happen sometimes but typically would cause a crash somewhere 
after a few fork()/execv's.

Thanks, Ron M.  

More information about the gcc mailing list