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 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.
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
}
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;
{
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;
}
}
else
{
+ child->process_state = PID_REAPED;
w->status = (__uint16_t) child->exitcode;
add_rusage (&myself->rusage_children, &child->rusage_children);