From 3f7bd531155175f7c8158b68fcaf9e1aa98f9c1d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 17 Oct 2000 18:55:58 +0000 Subject: * sigproc.cc (proc_subproc): Remove unneeded test for correct process in PROC_ADDCHILD. Return 0 when terminated child has just been reparented. (wait_subproc): Only send SIGCHLD when proc_subproc returns != 0. * strace.cc (strace::vsprntf): Only strip .exe extension from program name. --- winsup/cygwin/sigproc.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'winsup/cygwin/sigproc.cc') diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 46f8b6108..d98bd0e11 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -248,14 +248,6 @@ proc_subproc (DWORD what, DWORD val) case PROC_ADDCHILD: if (nchildren >= PSIZE - 1) system_printf ("nchildren too large %d", nchildren); - if (WaitForSingleObject (vchild->hProcess, 0) != WAIT_TIMEOUT) - { - system_printf ("invalid process handle %p. pid %d, win pid %d", - vchild->hProcess, vchild->pid, vchild->dwProcessId); - rc = 0; - break; - } - pchildren[nchildren] = vchild; hchildren[nchildren] = vchild->hProcess; if (!DuplicateHandle (hMainProc, vchild->hProcess, hMainProc, &vchild->pid_handle, @@ -278,7 +270,6 @@ proc_subproc (DWORD what, DWORD val) * (called from wait_subproc thread) */ case PROC_CHILDTERMINATED: - rc = 0; if (hchildren[val] != pchildren[val]->hProcess) { sigproc_printf ("pid %d[%d], reparented old hProcess %p, new %p", @@ -286,6 +277,7 @@ proc_subproc (DWORD what, DWORD val) ForceCloseHandle1 (hchildren[val], childhProc); hchildren[val] = pchildren[val]->hProcess; /* Filled out by child */ ProtectHandle1 (pchildren[val]->hProcess, childhProc); + rc = 0; break; // This was an exec() } @@ -1275,12 +1267,15 @@ wait_subproc (VOID *) rc -= WAIT_OBJECT_0; if (rc-- != 0) { - (void) proc_subproc (PROC_CHILDTERMINATED, rc); + rc = proc_subproc (PROC_CHILDTERMINATED, rc); if (!proc_loop_wait) // Don't bother if wait_subproc is break; // exiting - /* Send a SIGCHLD to myself. */ - rc = sig_send (myself_nowait, SIGCHLD); + /* Send a SIGCHLD to myself. We do this here, rather than in proc_subproc + to avoid the proc_subproc lock since the signal thread will eventually + be calling proc_subproc and could unnecessarily block. */ + if (rc) + sig_send (myself_nowait, SIGCHLD); } sigproc_printf ("looping"); } -- cgit v1.2.3