Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Nov 2006 13:55:53 -0500
From:      Jared Yanovich <phirerunner@comcast.net>
To:        freebsd-hackers@freebsd.org
Subject:   save process exit status in kevent NOTE_EXIT
Message-ID:  <20061117135553.14cfdaa1.phirerunner@comcast.net>

next in thread | raw e-mail | index | archive | help
Any reason why this may be a bad idea?  I think it'd be useful
for a pwait(1)-like utility (from Solaris).

Index: lib/libc/sys/kqueue.2
===================================================================
RCS file: /home/ncvs/src/lib/libc/sys/kqueue.2,v
retrieving revision 1.44
diff -u -p -r1.44 kqueue.2
--- lib/libc/sys/kqueue.2	17 Sep 2006 21:27:34 -0000	1.44
+++ lib/libc/sys/kqueue.2	17 Nov 2006 18:50:48 -0000
@@ -364,6 +364,8 @@ The events to monitor are:
 .Bl -tag -width XXNOTE_TRACKERR
 .It NOTE_EXIT
 The process has exited.
+The exit status will be stored in
+.Va data .
 .It NOTE_FORK
 The process has called
 .Fn fork .
Index: sys/kern/kern_event.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_event.c,v
retrieving revision 1.106
diff -u -p -r1.106 kern_event.c
--- sys/kern/kern_event.c	25 Sep 2006 01:29:48 -0000	1.106
+++ sys/kern/kern_event.c	17 Nov 2006 18:50:49 -0000
@@ -396,6 +396,7 @@ filt_proc(struct knote *kn, long hint)
 		if (!(kn->kn_status & KN_DETACHED))
 			knlist_remove_inevent(&p->p_klist, kn);
 		kn->kn_flags |= (EV_EOF | EV_ONESHOT);
+		kn->kn_data = kn->kn_ptr.p_proc->p_xstat;
 		kn->kn_ptr.p_proc = NULL;
 		return (1);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061117135553.14cfdaa1.phirerunner>