summaryrefslogtreecommitdiff
path: root/proc/wait.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-05-09 23:16:40 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-05-09 23:16:40 +0000
commitb27c37539750e0fbf992f29796cda978b2d27494 (patch)
tree9c99ac9ae8e2759bb59e64a79e988f093f52103a /proc/wait.c
parent05b7e06a1c54c585c2e2f2a51ef43a10dc31fafd (diff)
(S_proc_wait): New parm SIGCODE; return p_sigcode in it.
(S_proc_mark_stop): New parm SIGCODE; record it. (S_proc_mark_exit): Likewise. (alert_parent): Set P->p_sigcode if process is dying irregularly.
Diffstat (limited to 'proc/wait.c')
-rw-r--r--proc/wait.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/proc/wait.c b/proc/wait.c
index 6c862887..8a42b3ef 100644
--- a/proc/wait.c
+++ b/proc/wait.c
@@ -52,7 +52,10 @@ alert_parent (struct proc *p)
send_signal (p->p_parent->p_msgport, SIGCHLD, p->p_parent->p_task);
if (!p->p_exiting)
- p->p_status = W_EXITCODE (0, SIGKILL);
+ {
+ p->p_status = W_EXITCODE (0, SIGKILL);
+ p->p_sigcode = -1;
+ }
if (p->p_parent->p_waiting)
{
@@ -68,6 +71,7 @@ S_proc_wait (struct proc *p,
pid_t pid,
int options,
int *status,
+ int *sigcode,
struct rusage *ru,
pid_t *pid_status)
{
@@ -104,6 +108,7 @@ S_proc_wait (struct proc *p,
{
child->p_waited = 1;
*status = child->p_status;
+ *sigcode = child->p_sigcode;
if (child->p_dead)
complete_exit (child);
bzero (ru, sizeof (struct rusage));
@@ -125,6 +130,7 @@ S_proc_wait (struct proc *p,
{
child->p_waited = 1;
*status = child->p_status;
+ *sigcode = child->p_sigcode;
*pid_status = child->p_pid;
if (child->p_dead)
complete_exit (child);
@@ -152,13 +158,15 @@ S_proc_wait (struct proc *p,
/* Implement proc_mark_stop as described in <hurd/proc.defs>. */
kern_return_t
S_proc_mark_stop (struct proc *p,
- int signo)
+ int signo,
+ int sigcode)
{
if (!p)
return EOPNOTSUPP;
p->p_stopped = 1;
p->p_status = W_STOPCODE (signo);
+ p->p_sigcode = sigcode;
p->p_waited = 0;
if (p->p_parent->p_waiting)
@@ -176,7 +184,8 @@ S_proc_mark_stop (struct proc *p,
/* Implement proc_mark_exit as described in <hurd/proc.defs>. */
kern_return_t
S_proc_mark_exit (struct proc *p,
- int status)
+ int status,
+ int sigcode)
{
if (!p)
return EOPNOTSUPP;
@@ -186,6 +195,7 @@ S_proc_mark_exit (struct proc *p,
p->p_exiting = 1;
p->p_status = status;
+ p->p_sigcode = sigcode;
return 0;
}