Cygwin: pinfo: stop remember doing reattach

During fork, the child process requires the process table to be
initialized for fixup_shms_after_fork, while still allowing subsequent
dlls.load_after_fork to fail silently (for when the "forkable" hardlinks
are not created yet).
pinfo::remember not performing reattach anymore requires explicit
pinfo::reattach now where appropriate.

Prepares to improve "Cygwin: fork: Remember child not before success."
commit f03ea8e1c5, which leads to fork
problems if cygserver is running:

https://cygwin.com/ml/cygwin-patches/2019-q2/msg00155.html
This commit is contained in:
Michael Haubenwallner
2019-07-31 12:35:31 +02:00
committed by Corinna Vinschen
parent 6661a67747
commit 23a779bf3d
3 changed files with 14 additions and 5 deletions

View File

@@ -216,9 +216,7 @@ proc_subproc (DWORD what, uintptr_t val)
vchild->process_state |= PID_INITIALIZING;
vchild->ppid = what == PROC_DETACHED_CHILD ? 1 : myself->pid; /* always set last */
}
if (what == PROC_DETACHED_CHILD)
break;
/* fall through intentionally */
break;
case PROC_REATTACH_CHILD:
procs[nprocs] = vchild;
@@ -873,7 +871,8 @@ void
child_info_spawn::wait_for_myself ()
{
postfork (myself);
myself.remember (false);
if (myself.remember (false))
myself.reattach ();
WaitForSingleObject (ev, INFINITE);
}