+Fri Sep 1 21:17:03 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * sigproc.cc (mychild): New function.
+ (proc_subproc): Use mychild() to determine if a specific pid is valid
+ for wait()ing.
+
Fri Sep 1 16:57:44 2000 Christopher Faylor <cgf@cygnus.com>
* sigproc.cc (sigproc_init): Create wait_sig_inited without auto-reset
#include "pinfo.h"
#include "child_info.h"
#include "perthread.h"
-
-extern BOOL allow_ntsec;
+#include <assert.h>
/*
* Convenience defines
return FALSE;
}
+/* Return 1 if this is one of our children, zero otherwise.
+ FIXME: This really should be integrated with the rest of the proc_subproc
+ testing. Scanning these lists twice is inefficient. */
+int __stdcall
+mychild (int pid)
+{
+ for (int i = 0; i < nchildren; i++)
+ if (pchildren[i]->pid == pid)
+ return 1;
+ for (int i = 0; i < nzombies; i++)
+ if (zombies[i]->pid == pid)
+ return 1;
+ return 0;
+}
+
/* Handle all subprocess requests
*/
#define vchild (*((pinfo *) val))
{
int rc = 1;
int potential_match;
- DWORD exitcode;
_pinfo *child;
int clearing;
waitq *w;
*/
case PROC_CHILDTERMINATED:
rc = 0;
- if (GetExitCodeProcess (hchildren[val], &exitcode) &&
- hchildren[val] != pchildren[val]->hProcess)
+ if (hchildren[val] != pchildren[val]->hProcess)
{
sigproc_printf ("pid %d[%d], reparented old hProcess %p, new %p",
pchildren[val]->pid, val, hchildren[val], pchildren[val]->hProcess);
if (wval->pid <= 0)
child = NULL; // Not looking for a specific pid
- else if (!pid_exists (wval->pid)) /* CGF FIXME -- test that this is one of mine */
+ else if (!mychild (wval->pid))
goto out; // invalid pid. flag no such child
wval->status = 0; // Don't know status yet
/*sigproc_printf ("I'm going away now")*/;
else
system_printf ("%E releasing sigcatch_nosync(%p)", sigcatch_nosync);
-
+
}
return was_pending;
}