Cygwin: drop PROC_DETACHED_CHILD flag
pinfo::remember with the detach parameter set to true is the only way to call proc_subproc with PROC_DETACHED_CHILD. This call is exclusively used in spawn to set up a pinfo for a detached child, and that pinfo goes out of scope right afterwards without any further action. Drop the flag and drop the detach parameter from pinfo::remember. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
558fa888e5
commit
163daed37c
@ -415,7 +415,7 @@ frok::parent (volatile char * volatile stack_here)
|
|||||||
it in afterwards. This requires more bookkeeping than I like, though,
|
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
|
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. */
|
we can't actually record the pid in the internal table. */
|
||||||
if (!child.remember (false))
|
if (!child.remember ())
|
||||||
{
|
{
|
||||||
this_errno = EAGAIN;
|
this_errno = EAGAIN;
|
||||||
#ifdef DEBUGGING0
|
#ifdef DEBUGGING0
|
||||||
|
@ -196,10 +196,9 @@ public:
|
|||||||
destroy = res ? false : true;
|
destroy = res ? false : true;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
int remember (bool detach)
|
int remember ()
|
||||||
{
|
{
|
||||||
int res = proc_subproc (detach ? PROC_DETACHED_CHILD : PROC_ADD_CHILD,
|
int res = proc_subproc (PROC_ADD_CHILD, (uintptr_t) this);
|
||||||
(uintptr_t) this);
|
|
||||||
destroy = res ? false : true;
|
destroy = res ? false : true;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -205,9 +205,6 @@ proc_subproc (DWORD what, uintptr_t val)
|
|||||||
set_errno (EAGAIN);
|
set_errno (EAGAIN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fallthrough;
|
|
||||||
|
|
||||||
case PROC_DETACHED_CHILD:
|
|
||||||
if (vchild != myself)
|
if (vchild != myself)
|
||||||
{
|
{
|
||||||
vchild->uid = myself->uid;
|
vchild->uid = myself->uid;
|
||||||
@ -217,8 +214,7 @@ proc_subproc (DWORD what, uintptr_t val)
|
|||||||
vchild->ctty = myself->ctty;
|
vchild->ctty = myself->ctty;
|
||||||
vchild->cygstarted = true;
|
vchild->cygstarted = true;
|
||||||
vchild->process_state |= PID_INITIALIZING;
|
vchild->process_state |= PID_INITIALIZING;
|
||||||
vchild->ppid = what == PROC_DETACHED_CHILD
|
vchild->ppid = myself->pid; /* always set last */
|
||||||
? 1 : myself->pid; /* always set last */
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -879,7 +875,7 @@ void
|
|||||||
child_info_spawn::wait_for_myself ()
|
child_info_spawn::wait_for_myself ()
|
||||||
{
|
{
|
||||||
postfork (myself);
|
postfork (myself);
|
||||||
if (myself.remember (false))
|
if (myself.remember ())
|
||||||
myself.attach ();
|
myself.attach ();
|
||||||
WaitForSingleObject (ev, INFINITE);
|
WaitForSingleObject (ev, INFINITE);
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,10 @@ enum procstuff
|
|||||||
PROC_ADD_CHILD = 1, // set up a new child
|
PROC_ADD_CHILD = 1, // set up a new child
|
||||||
PROC_ATTACH_CHILD = 2, // attach child or reattach after exec
|
PROC_ATTACH_CHILD = 2, // attach child or reattach after exec
|
||||||
PROC_EXEC_CLEANUP = 3, // cleanup waiting children after exec
|
PROC_EXEC_CLEANUP = 3, // cleanup waiting children after exec
|
||||||
PROC_DETACHED_CHILD = 4, // set up a detached child
|
PROC_CLEARWAIT = 4, // clear all waits - signal arrived
|
||||||
PROC_CLEARWAIT = 5, // clear all waits - signal arrived
|
PROC_WAIT = 5, // setup for wait() for subproc
|
||||||
PROC_WAIT = 6, // setup for wait() for subproc
|
PROC_EXECING = 6, // used to get a lock when execing
|
||||||
PROC_EXECING = 7, // used to get a lock when execing
|
PROC_NOTHING = 7 // nothing, really
|
||||||
PROC_NOTHING = 8 // nothing, really
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sigpacket
|
struct sigpacket
|
||||||
|
@ -867,9 +867,8 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
|||||||
child->start_time = time (NULL); /* Register child's starting time. */
|
child->start_time = time (NULL); /* Register child's starting time. */
|
||||||
child->nice = myself->nice;
|
child->nice = myself->nice;
|
||||||
postfork (child);
|
postfork (child);
|
||||||
if (mode == _P_DETACH
|
if (mode != _P_DETACH
|
||||||
? !child.remember (true)
|
&& (!child.remember () || !child.attach ()))
|
||||||
: !(child.remember (false) && child.attach ()))
|
|
||||||
{
|
{
|
||||||
/* FIXME: Child in strange state now */
|
/* FIXME: Child in strange state now */
|
||||||
CloseHandle (pi.hProcess);
|
CloseHandle (pi.hProcess);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user