* 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.
This commit is contained in:
parent
5a519b88fa
commit
b7d95b5bb5
|
@ -1,3 +1,17 @@
|
|||
2012-03-21 Christopher Faylor <me.cygwin2012@cgf.cx>
|
||||
|
||||
* 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.
|
||||
|
||||
2012-03-21 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* cygtls.cc (well_known_dlls): Add advapi32.dll.
|
||||
|
|
|
@ -35,7 +35,7 @@ enum child_status
|
|||
#define EXEC_MAGIC_SIZE sizeof(child_info)
|
||||
|
||||
/* Change this value if you get a message indicating that it is out-of-sync. */
|
||||
#define CURR_CHILD_INFO_MAGIC 0x4a52da7eU
|
||||
#define CURR_CHILD_INFO_MAGIC 0x10f103a4U
|
||||
|
||||
#define NPROCS 256
|
||||
|
||||
|
@ -82,10 +82,16 @@ public:
|
|||
bool saw_ctrl_c () const {return !!(flag & _CI_SAW_CTRL_C);}
|
||||
void prefork (bool = false);
|
||||
void cleanup ();
|
||||
void postfork (pinfo& child)
|
||||
{
|
||||
ForceCloseHandle (wr_proc_pipe);
|
||||
wr_proc_pipe = NULL;
|
||||
child.set_rd_proc_pipe (rd_proc_pipe);
|
||||
rd_proc_pipe = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
class mount_info;
|
||||
class _pinfo;
|
||||
|
||||
class child_info_fork: public child_info
|
||||
{
|
||||
|
|
|
@ -426,7 +426,7 @@ frok::parent (volatile char * volatile stack_here)
|
|||
/* Fill in fields in the child's process table entry. */
|
||||
child->dwProcessId = pi.dwProcessId;
|
||||
child.hProcess = hchild;
|
||||
child.set_rd_proc_pipe (ch.rd_proc_pipe);
|
||||
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
|
||||
|
|
|
@ -139,7 +139,7 @@ public:
|
|||
HANDLE hProcess;
|
||||
HANDLE rd_proc_pipe;
|
||||
pinfo_minimal (): h (NULL), hProcess (NULL), rd_proc_pipe (NULL) {}
|
||||
void set_rd_proc_pipe (HANDLE& h) {rd_proc_pipe = h; h = NULL;}
|
||||
void set_rd_proc_pipe (HANDLE& h) {rd_proc_pipe = h;}
|
||||
friend class pinfo;
|
||||
};
|
||||
|
||||
|
|
|
@ -914,9 +914,7 @@ cygheap_exec_info::alloc ()
|
|||
void
|
||||
child_info_spawn::wait_for_myself ()
|
||||
{
|
||||
myself.set_rd_proc_pipe (rd_proc_pipe);
|
||||
ForceCloseHandle (wr_proc_pipe);
|
||||
wr_proc_pipe = NULL;
|
||||
postfork (myself);
|
||||
myself.remember (false);
|
||||
WaitForSingleObject (ev, INFINITE);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue