]> sourceware.org Git - newlib-cygwin.git/commitdiff
* signal.cc (_pinfo::kill): Return success on kill(0) only if pid exists or is
authorChristopher Faylor <me@cgf.cx>
Thu, 5 May 2011 00:31:22 +0000 (00:31 +0000)
committerChristopher Faylor <me@cgf.cx>
Thu, 5 May 2011 00:31:22 +0000 (00:31 +0000)
in PID_EXITED state.  Report pid 0 when pid does not exist rather than pid -1.
Make debug output reflect actual function call.
* sigproc.cc (stopped_or_terminated): Set process state to reaped when we've
finished waiting for it.
* include/sys/cygwin.h (PID_REAPED): New enum.

winsup/cygwin/ChangeLog
winsup/cygwin/include/sys/cygwin.h
winsup/cygwin/signal.cc
winsup/cygwin/sigproc.cc

index bc7053240bba1ee3af63a46b42ace4100c1f90a3..7daf6051ebbfa2a3cf6ff47298f0d8d825d9d1d5 100644 (file)
@@ -1,3 +1,12 @@
+2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * signal.cc (_pinfo::kill): Return success on kill(0) only if pid
+       exists or is in PID_EXITED state.  Report pid 0 when pid does not exist
+       rather than pid -1.  Make debug output reflect actual function call.
+       * sigproc.cc (stopped_or_terminated): Set process state to reaped when
+       we've finished waiting for it.
+       * include/sys/cygwin.h (PID_REAPED): New enum.
+
 2011-05-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
 
        * cygwin.din (psiginfo): Export.
index a6e63b282276428f37da530ac77c92c8f40e768c..7e856cd9b0fec08897bef8258a485ce73c567489 100644 (file)
@@ -168,7 +168,8 @@ enum
   PID_ALLPIDS         = 0x02000, /* used by pinfo scanner */
   PID_EXECED          = 0x04000, /* redirect to original pid info block */
   PID_NOREDIR         = 0x08000, /* don't redirect if execed */
-  PID_EXITED          = 0x80000000 /* Free entry. */
+  PID_EXITED          = 0x40000000, /* Free entry. */
+  PID_REAPED          = 0x80000000  /* Reaped */
 };
 
 #ifdef WINVER
index 78b0f1d5bb3acbfef0bdef62c686b0ce3752c20a..8d9f592a49c79e7abf3389b64c830fc681d4ae32 100644 (file)
@@ -250,7 +250,7 @@ _pinfo::kill (siginfo_t& si)
        }
       this_pid = pid;
     }
-  else if (si.si_signo == 0 && this)
+  else if (si.si_signo == 0 && this && process_state == PID_EXITED)
     {
       this_process_state = process_state;
       this_pid = pid;
@@ -260,12 +260,12 @@ _pinfo::kill (siginfo_t& si)
     {
       set_errno (ESRCH);
       this_process_state = 0;
-      this_pid = -1;
+      this_pid = 0;
       res = -1;
     }
 
-  syscall_printf ("%d = _pinfo::kill (%d, %d), process_state %p", res, this_pid,
-                 si.si_signo, this_process_state);
+  syscall_printf ("%d = _pinfo::kill (%d), pid %d, process_state %p", res,
+                 si.si_signo, this_pid, this_process_state);
   return res;
 }
 
index 2d2db78a4ae77e391bcf904a93606d628dfbfd1b..43655dc4c29a717f3be717c2b26e7fd846933583 100644 (file)
@@ -1041,6 +1041,7 @@ stopped_or_terminated (waitq *parent_w, _pinfo *child)
     }
   else
     {
+      child->process_state = PID_REAPED;
       w->status = (__uint16_t) child->exitcode;
 
       add_rusage (&myself->rusage_children, &child->rusage_children);
This page took 0.041215 seconds and 5 git commands to generate.