[Patch] kqueue(2) <-> procdesc(4): EVFILT_PROCDESC

Ed Schouten ed at 80386.nl
Mon Apr 7 18:13:38 UTC 2014


Hi,

On 6 April 2014 17:16, Ed Schouten <ed at 80386.nl> wrote:
> My plan was initially to mimick filt_proc() almost entirely and just
> use KNOTE_LOCKED(..., NOTE_EXIT) just like EVFILT_PROC does, but
> unfortunately this doesn't seem possible, because if we went down this
> path, there would be no way for us to activate the knote in
> procdesc_kqfilter() immediately, as KNOTE_ACTIVATE() is not available
> outside of kern_event.c.
>
> This is why I just changed the code, so that procdesc_kqops_event() is
> almost literally a copy of filt_proc(), which the difference that it
> tests against PDF_EXITED instead of using the hint. While there, I
> made some style fixes to filt_proc(). Thoughts?

After looking at the kqueue code in a bit more detail, I think I have
now found a nice middle way. kevent(2) itself will only call into the
kqfilter with hint == 0. I have decided to let procdesc_kqops_event()
be a literal copy of filt_proc(), with the difference that if hint ==
0, it tests against PDF_EXITED.

As it seems to work quite well, I've decided to push this in
(r264231). Thanks for the review!

-- 
Ed Schouten <ed at 80386.nl>


More information about the freebsd-arch mailing list