* 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.
This commit is contained in:
Christopher Faylor 2000-10-17 18:55:58 +00:00
parent e6f5c9d57d
commit 3f7bd53115
4 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,12 @@
Tue Oct 17 14:50:31 2000 Christopher Faylor <cgf@cygnus.com>
* 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.
2000-10-16 Charles Wilson <cwilson@ece.gatech.edu>
* fhandler_clipboard.cc: new file

View File

@ -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");
}

View File

@ -130,7 +130,7 @@ strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap)
else
p = pn;
strcpy (progname, p);
if ((p = strrchr (progname, '.')) != NULL)
if ((p = strrchr (progname, '.')) != NULL && strcasematch (p, ".exe"))
*p = '\000';
p = progname;
count = __small_sprintf (buf, fmt, p && *p ? p : "?",

View File

@ -920,7 +920,7 @@ _fstat (int fd, struct stat *buf)
{
memset (buf, 0, sizeof (struct stat));
r = fdtab[fd]->fstat (buf);
syscall_printf ("%d = fstat (%d, %x)", r,fd,buf);
syscall_printf ("%d = fstat (%d, %x)", r, fd, buf);
}
return r;