cvs commit: src/include Makefile spawn.h unistd.h src/lib/libc/gen exec.3 exec.c posix_spawn.c

Kostik Belousov kostikbel at
Tue Jun 17 20:19:42 UTC 2008

On Tue, Jun 17, 2008 at 11:22:40AM -0400, John Baldwin wrote:
> On Tuesday 17 June 2008 11:15:20 am Maxim Sobolev wrote:
> > Ed Schouten wrote:
> > > * David Schultz <das at FreeBSD.ORG> wrote:
> > >> I have no objections to this, but doesn't it defeat the whole
> > >> purpose to implement posix_spawn() as a library function that just
> > >> calls fork/exec?
> > > 
> > > When (if?) applications start to use posix_spawn() we may decide to move
> > > it into the kernel at any time. It should be okay for now.
> > 
> > Are there any benefits of doing it in the kernel vs. doing it via fork+exec?
> Speed.  You don't have to go mark all your pages as COW or some such only to 
> turn around and throw the new mappings away and undo that.

The committed implementation uses vfork(). No COW is needed.

On the other hand, after single-threading of the parent process have
been removed from fork1(9), vfork(2) could have interesting consequences
when done from the multithreaded process.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url :

More information about the cvs-src mailing list