fok() execve() -> No child processes

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Fri Sep 9 01:32:16 PDT 2005


On Thu, Sep 08, 2005 at 12:40:20PM -0700, erkan kolemen wrote:
> Following code fails. I debugged it and saw that: it
> produces "No child processes" error while wait().
> 
> is it possible, parent still is not start to wait but
> child finished. After that CPU schedules parents. It
> try to start wait but child has finished.
> 
> is it possible... What can i do for that?

If you want to use vfork(), then you should know that a child
will borrow parent's memory and a parent is suspended while a
child is using its resources (at least in BSD).  A child is
allowed to call only execve() or _exit() and it is not allowed
to return from the function in which vfork() was called.  A child
can modify some data in the parent's memory (really shared memory
by both processes), but this memory should be volatile (try to
modify non-volatile variable in a child and check result in
a parent and compile this test program with optimization).

Read description and "application usage" of vfork() in SUSv3, it
gives very hard limits on vfork() usage (if you are interesting in
creating portable software).

Also find discussions about vfork() in this mailing list and
read another limitations on its usage in found letters.


More information about the freebsd-hackers mailing list