Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-09-02 05:19:58 +0400
committerChristopher Faylor <me@cgf.cx>2000-09-02 05:19:58 +0400
commit0ef7862533e7b862193221f38242297010697160 (patch)
tree3d2064a2991c0a75da69ad8ba516c5df95a0d16b /winsup
parent837528aa51777d445e6fd5b6f4da4c3d99b82592 (diff)
* sigproc.cc (mychild): New function.
(proc_subproc): Use mychild() to determine if a specific pid is valid for wait()ing.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/sigproc.cc26
2 files changed, 25 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 2be8e4fb4..7a67363da 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 30976b62a..93313525d 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -22,8 +22,7 @@ details. */
#include "pinfo.h"
#include "child_info.h"
#include "perthread.h"
-
-extern BOOL allow_ntsec;
+#include <assert.h>
/*
* Convenience defines
@@ -244,6 +243,21 @@ proc_exists (_pinfo *p)
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))
@@ -252,7 +266,6 @@ proc_subproc (DWORD what, DWORD val)
{
int rc = 1;
int potential_match;
- DWORD exitcode;
_pinfo *child;
int clearing;
waitq *w;
@@ -303,8 +316,7 @@ proc_subproc (DWORD what, DWORD val)
*/
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);
@@ -391,7 +403,7 @@ proc_subproc (DWORD what, DWORD val)
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
@@ -595,7 +607,7 @@ sig_dispatch_pending (int justwake)
/*sigproc_printf ("I'm going away now")*/;
else
system_printf ("%E releasing sigcatch_nosync(%p)", sigcatch_nosync);
-
+
}
return was_pending;
}