Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-03-21 19:54:50 +0400
committerChristopher Faylor <me@cgf.cx>2012-03-21 19:54:50 +0400
commitb7d95b5bb5d62be24509256b486dd34285490e04 (patch)
tree2b78b1d3efd8d67c3317469bc4dc9972062662f9 /winsup/cygwin/spawn.cc
parent5a519b88fab85d6911abbdc019461e4a6190e704 (diff)
* child_info.h (child_info::postfork): Define new function.
* fork.cc (frok::parent): Call postfork to do all of the manipulation required prior to calling pinfo::remember. * pinfo.h (pinfo::set_rd_proc_pipe): Just set pinfo's rd_proc_pipe. Don't bother setting it to NULL. * sigproc.cc (child_info_spawn::wait_for_myself): Call postfork to set up myself for waiting. * spawn.cc (child_info_spawn::worker): Avoid now-unnecessary global lock. Consistently test mode rather than chtype when making wr_proc_pipe decisions. Call postfork() to set up stuff prior to pinfo::remember.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index f3d917aed..c05c7af9f 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -308,9 +308,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
return -1;
}
- hold_everything for_now;
/* FIXME: There is a small race here and FIXME: not thread safe! */
-
pthread_cleanup cleanup;
if (mode == _P_SYSTEM)
{
@@ -616,7 +614,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
if (mode == _P_DETACH)
/* all set */;
- else if (chtype != _CH_EXEC || !my_wr_proc_pipe)
+ else if (mode != _P_OVERLAY || !my_wr_proc_pipe)
prefork ();
else
wr_proc_pipe = my_wr_proc_pipe;
@@ -769,7 +767,6 @@ loop:
/* Name the handle similarly to proc_subproc. */
ProtectHandle1 (pi.hProcess, childhProc);
- bool synced;
pid_t pid;
if (mode == _P_OVERLAY)
{
@@ -796,7 +793,6 @@ loop:
res = -1;
goto out;
}
- child.set_rd_proc_pipe (rd_proc_pipe);
child->dwProcessId = pi.dwProcessId;
child.hProcess = pi.hProcess;
@@ -810,6 +806,7 @@ loop:
pi.hProcess, NULL, 0, 0, DUPLICATE_SAME_ACCESS);
child->start_time = time (NULL); /* Register child's starting time. */
child->nice = myself->nice;
+ postfork (child);
if (!child.remember (mode == _P_DETACH))
{
/* FIXME: Child in strange state now */
@@ -832,6 +829,7 @@ loop:
sigproc_printf ("spawned windows pid %d", pi.dwProcessId);
+ bool synced;
if ((mode == _P_DETACH || mode == _P_NOWAIT) && !iscygwin ())
synced = false;
else