summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/sigproc.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-10-17 18:55:58 +0000
committerChristopher Faylor <me@cgf.cx>2000-10-17 18:55:58 +0000
commit3f7bd531155175f7c8158b68fcaf9e1aa98f9c1d (patch)
tree88fccf772ceea83392c3ef91f8fd831422a76d15 /winsup/cygwin/sigproc.cc
parente6f5c9d57d2c36296d8eed223c92a3084ccf4a93 (diff)
downloadcygnal-3f7bd531155175f7c8158b68fcaf9e1aa98f9c1d.tar.gz
cygnal-3f7bd531155175f7c8158b68fcaf9e1aa98f9c1d.tar.bz2
cygnal-3f7bd531155175f7c8158b68fcaf9e1aa98f9c1d.zip
* 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.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc19
1 files changed, 7 insertions, 12 deletions
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");
}