From e8454a340033a287a9245e049a6f23eb68ec7f95 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 17 Jul 2005 00:51:03 +0000 Subject: * 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. --- winsup/cygwin/sigproc.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'winsup/cygwin/sigproc.cc') 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; } -- cgit v1.2.3