tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make: cannot vfork() twice - on darwin



On Thu, Apr 22, 2010 at 03:25:53PM -0700, Simon J. Gerraty wrote:
 > This is "cute", only seems to impact darwin so far.
 > We get an error from vfork() if we've already done it
 > (this happens when trying to export a var that uses :sh in the child).

vforking twice is not allowed.

 > Index: main.c

How about centralizing the logic, something like

   pid_t
   try_vfork(void)
   {
           static bool vforked;
           pid_t ret;

           if (vforked) {
                   return fork();
           }
           ret = vfork();
           vforked = (ret == 0);
           return ret;
   }

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index