OSDN Git Service

* fork.cc (fork): Lock the process before forking to prevent things like new
authorcgf <cgf>
Fri, 14 Jul 2006 22:15:12 +0000 (22:15 +0000)
committercgf <cgf>
Fri, 14 Jul 2006 22:15:12 +0000 (22:15 +0000)
fds from being opened, etc.
* sync.h (lock_process::dont_bother): New function.

winsup/cygwin/ChangeLog
winsup/cygwin/fork.cc
winsup/cygwin/sync.h

index a292b95..cf8ac0a 100644 (file)
@@ -1,5 +1,11 @@
 2006-07-14  Christopher Faylor  <cgf@timesys.com>
 
+       * fork.cc (fork): Lock the process before forking to prevent things
+       like new fds from being opened, etc.
+       * sync.h (lock_process::dont_bother): New function.
+
+2006-07-14  Christopher Faylor  <cgf@timesys.com>
+
        * include/cygwin/types.h: Update copyright.
 
 2006-07-14  Christopher Faylor  <cgf@timesys.com>
index 2043629..ed85e74 100644 (file)
@@ -533,6 +533,7 @@ fork ()
       return -1;
     }
 
+  lock_process now;
   if (sig_send (NULL, __SIGHOLD))
     {
       if (exit_state)
@@ -547,7 +548,10 @@ fork ()
   __asm__ volatile ("movl %%esp,%0": "=r" (esp));
 
   if (ischild)
-    res = grouped.child (esp);
+    {
+      res = grouped.child (esp);
+      now.dont_bother ();
+    }
   else
     {
       res = grouped.parent (esp);
index 8fd01df..f7ce7e1 100644 (file)
@@ -50,6 +50,7 @@ class lock_process
   static muto locker;
 public:
   static void init () {locker.init ("lock_process");}
+  void dont_bother () {skip_unlock = true;}
   lock_process (bool exiting = false)
   {
     locker.acquire ();