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

David Schultz das at FreeBSD.ORG
Tue Jun 17 17:07:27 UTC 2008


On Tue, Jun 17, 2008, 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?

The only reason spawn exists is to better support platforms where
fork is slow, so implementing it in terms of fork/exec defeats the
purpose and potentially tricks configure scripts into making
incorrect assumptions about performance tradeoffs. However, maybe
spawn would still be useful if misguided application writers used
it for other reasons (e.g., to make it easier to port Win32 apps),
and I'm guessing that's why it was added. Implementing it in the
kernel has disadvantages, too; in particular, it would add a lot
of complexity for gains that are likely to be minimal in FreeBSD.


More information about the cvs-src mailing list