summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/sigproc.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-07-17 00:51:03 +0000
committerChristopher Faylor <me@cgf.cx>2005-07-17 00:51:03 +0000
commite8454a340033a287a9245e049a6f23eb68ec7f95 (patch)
treee235728e012c817a8bc813232961e972d49f4ac1 /winsup/cygwin/sigproc.cc
parentcd929277d69996a60f29d17bb4d612063926a5f7 (diff)
downloadcygnal-e8454a340033a287a9245e049a6f23eb68ec7f95.tar.gz
cygnal-e8454a340033a287a9245e049a6f23eb68ec7f95.tar.bz2
cygnal-e8454a340033a287a9245e049a6f23eb68ec7f95.zip
* child_info.h (child_info::sync): Pass pid and HANDLE rather than using pinfo.
(child_info::child_info): Accept an argument controlling whether to create proc_subproc. (child_info_spawn::child_info_spawn): Ditto. * sigproc.cc (child_info::child_info): Ditto. (child_info_spawn::child_info_spawn): Ditto. (child_info::sync): Use passed in pid and HANDLE. * fork.cc (fork_parent): Reflect additional arguments required for child_info::sync. * hookapi.cc (hook_or_detect_cygwin): Rename. Change so that NULL 'fn' argument just returns "true", indicating that program uses cygwin1.dll. * spawn.cc (av::win16_exe): New element. * spawn.cc (av::iscygwin): New element. (av::fixup): New function. (spawn_guts): Protect against SEGV. Use fixup function to detect when it is safe to wait for a spawned (as opposed to an execed) program. Reflect changes in child_info::sync arguments. * external.cc (cygwin_internal): Reflect function renaming to hook_or_detect_cygwin. * cygheap.cc (cygheap_fixup_in_child): Close handle after debug fixup has been done to prevent false positives in handle collision. * exceptions.cc (try_to_debug): Notify debugger if already being debugged.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index d85064b18..2bb9d4eda 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -721,7 +721,7 @@ out:
/* Initialize some of the memory block passed to child processes
by fork/spawn/exec. */
-child_info::child_info (unsigned in_cb, child_info_types chtype)
+child_info::child_info (unsigned in_cb, child_info_types chtype, bool need_subproc_ready)
{
memset (this, 0, in_cb);
cb = in_cb;
@@ -730,7 +730,7 @@ child_info::child_info (unsigned in_cb, child_info_types chtype)
type = chtype;
fhandler_union_cb = sizeof (fhandler_union);
user_h = cygwin_user_h;
- if (chtype != PROC_SPAWN)
+ if (need_subproc_ready)
subproc_ready = CreateEvent (&sec_all, FALSE, FALSE, NULL);
sigproc_printf ("subproc_ready %p", subproc_ready);
cygheap = ::cygheap;
@@ -753,12 +753,12 @@ child_info::~child_info ()
}
child_info_fork::child_info_fork () :
- child_info (sizeof *this, _PROC_FORK)
+ child_info (sizeof *this, _PROC_FORK, true)
{
}
-child_info_spawn::child_info_spawn (child_info_types chtype) :
- child_info (sizeof *this, chtype)
+child_info_spawn::child_info_spawn (child_info_types chtype, bool need_subproc_ready) :
+ child_info (sizeof *this, chtype, need_subproc_ready)
{
}
@@ -786,7 +786,7 @@ child_info::ready (bool execed)
}
bool
-child_info::sync (pinfo& vchild, DWORD howlong)
+child_info::sync (pid_t pid, HANDLE hProcess, DWORD howlong)
{
if (!subproc_ready)
{
@@ -796,14 +796,14 @@ child_info::sync (pinfo& vchild, DWORD howlong)
HANDLE w4[2];
w4[0] = subproc_ready;
- w4[1] = vchild.hProcess;
+ w4[1] = hProcess;
bool res;
sigproc_printf ("waiting for subproc_ready(%p) and child process(%p)", w4[0], w4[1]);
switch (WaitForMultipleObjects (2, w4, FALSE, howlong))
{
case WAIT_OBJECT_0:
- sigproc_printf ("got subproc_ready for pid %d", vchild->pid);
+ sigproc_printf ("got subproc_ready for pid %d", pid);
res = true;
break;
case WAIT_OBJECT_0 + 1:
@@ -813,7 +813,7 @@ child_info::sync (pinfo& vchild, DWORD howlong)
res = false;
break;
default:
- system_printf ("wait failed, pid %d, %E", vchild->pid);
+ system_printf ("wait failed, pid %d, %E", pid);
res = false;
break;
}