Re: Porting vfork()

Jeff Epler (jepler@inetnebr.com)
Wed, 6 Jan 1999 21:03:44 -0600


On Tue, Jan 05, 1999 at 03:46:11PM -0600, kernel@draper.net wrote:
> So, the question: is linux vfork() behavior annoying anyone else and is it
> worth fixing? (other than to eliminate its appearance in the BUG area of the
> Linux fork() man page ;)

What are you doing with vfork? The reason vfork exists is in the special
case where fork() is followed by exec*(), and the memory copy (used to be?)
prohibitively expensive. [I am missing a reference to this effect, so I
can't be 100% authoritative. Reportedly, _The Magic Garden Explained_
talks about this, but I am passing this along secondhand]

Is it possible that you're taking advantage of the shared memory as
mentioned in SunOS 5.6's manpage for vfork, or the Stevens book mentioned
in the vfork-related message at [1] (be sure you read the reply at [2]?
In this case, you may be able to use clone(0, SIGCHLD) instead of vfork().
Maybe something like
#ifdef LINUX
#define vfork() clone(0, SIGCHLD)
#endif
but until you make clear what abuse of vfork() you're relying on, who knows
whether this does what you want.

Jeff
[1] http://www.sigmasoft.com/~openbsd/misc/msg00960.html
[2] http://www.sigmasoft.com/~openbsd/misc/msg00961.html

-- 
\/ http://www.slashdot.org/                      Jeff Epler jepler@inetnebr.com
Term, holidays, term, holidays, till we leave school, and then work, work,
work till we die.
		-- C.S. Lewis

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/