diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 38172ca1e..43a92738c 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -509,11 +509,11 @@ frok::parent (volatile char * volatile stack_here) /* Do not attach to the child before it has successfully initialized. Otherwise we may wait forever, or deliver an orphan SIGCHILD. */ - if (!child.reattach ()) + if (!child.attach ()) { this_errno = EAGAIN; #ifdef DEBUGGING0 - error ("child reattach failed"); + error ("child attach failed"); #endif goto cleanup; } diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index 23f308360..2db7d6a01 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -187,18 +187,18 @@ public: void preserve () { destroy = false; } void allow_remove () { destroy = true; } #ifndef SIG_BAD_MASK // kludge to ensure that sigproc.h included - // int reattach () {system_printf ("reattach is not here"); return 0;} + // int attach () {system_printf ("attach is not here"); return 0;} // int remember (bool) {system_printf ("remember is not here"); return 0;} #else - int reattach () + int attach () { - int res = proc_subproc (PROC_REATTACH_CHILD, (uintptr_t) this); + int res = proc_subproc (PROC_ATTACH_CHILD, (uintptr_t) this); destroy = res ? false : true; return res; } int remember (bool detach) { - int res = proc_subproc (detach ? PROC_DETACHED_CHILD : PROC_ADDCHILD, + int res = proc_subproc (detach ? PROC_DETACHED_CHILD : PROC_ADD_CHILD, (uintptr_t) this); destroy = res ? false : true; return res; diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index a5cf73bde..b29835ee6 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -195,7 +195,7 @@ proc_subproc (DWORD what, uintptr_t val) /* Add a new subprocess to the children arrays. * (usually called from the main thread) */ - case PROC_ADDCHILD: + case PROC_ADD_CHILD: /* Filled up process table? */ if (nprocs >= NPROCS) { @@ -217,11 +217,12 @@ proc_subproc (DWORD what, uintptr_t val) vchild->ctty = myself->ctty; vchild->cygstarted = true; vchild->process_state |= PID_INITIALIZING; - vchild->ppid = what == PROC_DETACHED_CHILD ? 1 : myself->pid; /* always set last */ + vchild->ppid = what == PROC_DETACHED_CHILD + ? 1 : myself->pid; /* always set last */ } break; - case PROC_REATTACH_CHILD: + case PROC_ATTACH_CHILD: procs[nprocs] = vchild; rc = procs[nprocs].wait (); if (rc) @@ -879,7 +880,7 @@ child_info_spawn::wait_for_myself () { postfork (myself); if (myself.remember (false)) - myself.reattach (); + myself.attach (); WaitForSingleObject (ev, INFINITE); } @@ -973,7 +974,7 @@ cygheap_exec_info::reattach_children (HANDLE parent) pinfo p (parent, children[i].p, children[i].pid); if (!p) debug_only_printf ("couldn't reattach child %d from previous process", children[i].pid); - else if (!p.reattach ()) + else if (!p.attach ()) debug_only_printf ("attach of child process %d failed", children[i].pid); else debug_only_printf ("reattached pid %d<%u>, process handle %p, rd_proc_pipe %p->%p", diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index f8f92d350..f6702f4a3 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -30,8 +30,8 @@ enum enum procstuff { - PROC_ADDCHILD = 1, // add a new subprocess to list - PROC_REATTACH_CHILD = 2, // reattach after exec + PROC_ADD_CHILD = 1, // set up a new child + PROC_ATTACH_CHILD = 2, // attach child or reattach after exec PROC_EXEC_CLEANUP = 3, // cleanup waiting children after exec PROC_DETACHED_CHILD = 4, // set up a detached child PROC_CLEARWAIT = 5, // clear all waits - signal arrived diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 8308bccf3..1efcdb366 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -869,7 +869,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, postfork (child); if (mode == _P_DETACH ? !child.remember (true) - : !(child.remember (false) && child.reattach ())) + : !(child.remember (false) && child.attach ())) { /* FIXME: Child in strange state now */ CloseHandle (pi.hProcess);