summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2019-06-11 08:11:01 -0400
committerKen Brown <kbrown@cornell.edu>2019-06-11 08:50:41 -0400
commit000f2409b118e85daaa7064b5375245b8f48ab27 (patch)
tree5860b98e236b2ff52fe277b1452f40794c5c9c4b
parenteb429ad509bf30a27a40b7a9b68d65915e18fb4f (diff)
downloadcygnal-000f2409b118e85daaa7064b5375245b8f48ab27.tar.gz
cygnal-000f2409b118e85daaa7064b5375245b8f48ab27.tar.bz2
cygnal-000f2409b118e85daaa7064b5375245b8f48ab27.zip
Revert "Cygwin: fork: Remember child not before success."
This reverts commit f03ea8e1c57bd5cea83f6cd47fa02870bdfeb1c5. That commit leads to fork problems if cygserver is running: https://cygwin.com/ml/cygwin-patches/2019-q2/msg00155.html
-rw-r--r--winsup/cygwin/fork.cc31
1 files changed, 15 insertions, 16 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index c69081fc0..59b13806c 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -181,8 +181,7 @@ frok::child (volatile char * volatile here)
cygheap->fdtab.fixup_after_fork (hParent);
/* Signal that we have successfully initialized, so the parent can
- - transfer data/bss for dynamically loaded dlls (if any), and
- - start up some tracker threads to remember the child, or
+ - transfer data/bss for dynamically loaded dlls (if any), or
- terminate the current fork call even if the child is initialized. */
sync_with_parent ("performed fork fixups and dynamic dll loading", true);
@@ -412,6 +411,20 @@ frok::parent (volatile char * volatile stack_here)
child.hProcess = hchild;
ch.postfork (child);
+ /* Hopefully, this will succeed. The alternative to doing things this
+ way is to reserve space prior to calling CreateProcess and then fill
+ it in afterwards. This requires more bookkeeping than I like, though,
+ so we'll just do it the easy way. So, terminate any child process if
+ we can't actually record the pid in the internal table. */
+ if (!child.remember (false))
+ {
+ this_errno = EAGAIN;
+#ifdef DEBUGGING0
+ error ("child remember failed");
+#endif
+ goto cleanup;
+ }
+
/* CHILD IS STOPPED */
debug_printf ("child is alive (but stopped)");
@@ -495,20 +508,6 @@ frok::parent (volatile char * volatile stack_here)
}
}
- /* Hopefully, this will succeed. The alternative to doing things this
- way is to reserve space prior to calling CreateProcess and then fill
- it in afterwards. This requires more bookkeeping than I like, though,
- so we'll just do it the easy way. So, terminate any child process if
- we can't actually record the pid in the internal table. */
- if (!child.remember (false))
- {
- this_errno = EAGAIN;
-#ifdef DEBUGGING0
- error ("child remember failed");
-#endif
- goto cleanup;
- }
-
/* Finally start the child up. */
resume_child (forker_finished);