diff options
author | ed <ed@FreeBSD.org> | 2014-04-07 18:10:49 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2014-04-07 18:10:49 +0000 |
commit | 87c17a9c6666c07778d84cde29bff0fe8830ca77 (patch) | |
tree | 86add6f815ce421c32d599a69a835b29dee9b881 /lib/libc/sys/kqueue.2 | |
parent | b9ab124041f69613e738fb1f1f6916cca7b0f786 (diff) | |
download | FreeBSD-src-87c17a9c6666c07778d84cde29bff0fe8830ca77.zip FreeBSD-src-87c17a9c6666c07778d84cde29bff0fe8830ca77.tar.gz |
Implement kqueue(2) for procdesc(4).
kqueue(2) already supports EVFILT_PROC. Add an EVFILT_PROCDESC that
behaves the same, but operates on a procdesc(4) instead. Only implement
NOTE_EXIT for now. The nice thing about NOTE_EXIT is that it also
returns the exit status of the process, meaning that we can now obtain
this value, even if pdwait4(2) is still unimplemented.
Notes:
- Simply reuse EVFILT_NETDEV for EVFILT_PROCDESC. As both of these will
be used on totally different descriptor types, this should not clash.
- Let procdesc_kqops_event() reuse the same structure as filt_proc().
The only difference is that procdesc_kqops_event() should also be able
to deal with the case where the process was already terminated after
registration. Simply test this when hint == 0.
- Fix some style(9) issues in filt_proc() to keep it consistent with the
newly added procdesc_kqops_event().
- Save the exit status of the process in pd->pd_xstat, as we cannot pick
up the proctree_lock from within procdesc_kqops_event().
Discussed on: arch@
Reviewed by: kib@
Diffstat (limited to 'lib/libc/sys/kqueue.2')
-rw-r--r-- | lib/libc/sys/kqueue.2 | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index 75c8207..1b2951e 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 4, 2013 +.Dd April 7, 2014 .Dt KQUEUE 2 .Os .Sh NAME @@ -412,6 +412,24 @@ and the child process will not signal a NOTE_CHILD event. On return, .Va fflags contains the events which triggered the filter. +.It EVFILT_PROCDESC +Takes the process descriptor created by +.Xr pdfork 2 +to monitor as the identifier and the events to watch for in +.Va fflags , +and returns when the associated process performs one or more of the +requested events. +The events to monitor are: +.Bl -tag -width XXNOTE_EXIT +.It NOTE_EXIT +The process has exited. +The exit status will be stored in +.Va data . +.El +.Pp +On return, +.Va fflags +contains the events which triggered the filter. .It EVFILT_SIGNAL Takes the signal number to monitor as the identifier and returns when the given signal is delivered to the process. |