Put the wait(2) exit status in "data" for NOTE_EXIT kevents.

This commit is contained in:
Brian Feldman 2000-05-17 01:16:11 +00:00
parent ccb3a748f4
commit a24b514d72
3 changed files with 12 additions and 2 deletions

View File

@ -290,6 +290,10 @@ The events to monitor are:
.Bl -tag -width XXNOTE_TRACKERR
.It NOTE_EXIT
The process has exited.
The
.Xr wait 2 -style
exit status is returned in
.Va data .
.It NOTE_FORK
The process has called
.Fn fork .

View File

@ -264,6 +264,11 @@ filt_proc(struct knote *kn, long hint)
if (event == NOTE_EXIT) {
kn->kn_status |= KN_DETACHED;
kn->kn_flags |= (EV_EOF | EV_ONESHOT);
/*
* Return the 16 bits of the wait(2) value.
*/
if (kn->kn_sfflags & NOTE_EXIT)
kn->kn_data = (intptr_t)hint & 0xffff;
return (1);
}

View File

@ -307,9 +307,10 @@ exit1(p, rv)
switchticks = ticks;
/*
* notify interested parties of our demise.
* Notify interested parties of our demise. Pass the lower (only)
* 16 bits of our exit code along with it.
*/
KNOTE(&p->p_klist, NOTE_EXIT);
KNOTE(&p->p_klist, NOTE_EXIT | (rv & 0xffff));
/*
* Notify parent that we're gone. If parent has the PS_NOCLDWAIT