Date: Fri, 9 Sep 2005 11:28:33 +0300 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: erkan kolemen <erkankolemen@yahoo.com> Cc: freebsd-hackers@freebsd.org Subject: Re: fok() execve() -> No child processes Message-ID: <20050909082833.GA278@pm514-9.comsys.ntu-kpi.kiev.ua> In-Reply-To: <20050908194020.21635.qmail@web33415.mail.mud.yahoo.com> References: <20050908194020.21635.qmail@web33415.mail.mud.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050909082833.GA278>