PATCH RFC: Remove fork from collect2

Zack Weinberg
Fri Mar 19 08:14:00 GMT 2004

Ian Lance Taylor <> writes:

> Zack Weinberg <> writes:
>> Gunther Nikl <> writes:
>> >   Yes, popen() is supported. It uses vfork+execl itself.
>> >   I just noticed that FreeBSDs popen() does uses vfork(). Thus it seems
>> >   possible to use it. I don't remember why vfork was dropped in pexecute
>> >   by Zack Weinberg.
>> It's not safe.  The pexecute child code does stuff you can't do after
>> vfork.
> Only in the error case, though, in which execv fails.  That case more
> or less never happens.
> How would you feel if we switched back to vfork, and changed the error
> handling?

If you can think of a reliable way to do the error handling while
using vfork, go right ahead.  I've been unable to come up with one.


More information about the Gcc-patches mailing list