kevent behavior

Jilles Tjoelker jilles at stack.nl
Wed Mar 25 22:42:53 UTC 2015


On Wed, Mar 25, 2015 at 03:37:41PM +0100, Ivan Radovanovic wrote:
> I saw this EVFILT_USER thing, and it looked to me like it could be used 
> to do much smarter unblocking of kevent but I believe manual page is 
> relatively unclear there - what I do not understand is:

> * how you trigger this user event (I would say with kevent if 
> corresponding structure's NOTE_TRIGGER flag is set, but that doesn't 
> sound logical since in my understanding kevent is basically like 
> select(2) (ie call which checks if something happened without triggering 
> things = call which reports about status change in system without 
> causing change itself)?

The changelist passed to kevent(2) causes changes to the kqueue. One
kevent(2) call can both change what is monitored and check whether
something has happened.

An example of EVFILT_USER is in tools/regression/kqueue/user.c.

> * how does this work process-wise - is one ident restricted to process 
> which created corresponding kqueue, or it is system wise (other process 
> could trigger my kevent if same ident value is used)?

The ident is per kqueue.

-- 
Jilles Tjoelker


More information about the freebsd-hackers mailing list