Georg Nikodym wrote:
When a UNIX process wants to create a child, it fork()s and exec()s.
The fork() duplicates the parent's address space. This was seen as
silly when 9 times out of 10 the child simply calls exec and thus was
born vfork(). vfork() has this problem, though that the child briefly
runs in the parents address space. The implications of this statement
are serious and have resulted in two things. First, standards authors
have had no choice but to say that you can't guarantee anything aside
from exec() or _exit() will work.
Which makes vfork() rather useless for spawning subprocesses. If you
can guarantee that dup2() (or similar) will work, then vfork() may be
of some use.
--
Glynn Clements <glynn(a)sensei.co.uk>