kqueue implementation

Suleiman Souhlal ssouhlal at FreeBSD.org
Tue May 22 17:25:32 UTC 2007


On May 21, 2007, at 6:48 AM, Daniel Molina Wegener wrote:

> On Monday 21 May 2007 03:57:58 John-Mark Gurney wrote:
>> Daniel Molina Wegener wrote this message on Sun, May 20, 2007
> at 18:31 -0400:
>>>    I'm coding an application using the kqueue facility, but
>>> I see that I can't handle open and read events. Is planned
>>> to implement these handlings in the future?. Also, which
>>> facility can I use to handle these kind of events?
>>
>> I'm unsure what you mean by open and read events?  Do you
>> mean getting an event when another process opens are file?
>> or?  As for read, they work fine for sockets, as w/ select,
>> files are always ready to read even though they may block to
>> read from disk...
>
> Hello,
>
> I mean vnode events, in the manual page I see NOTE_WRITE, but I
> need NOTE_OPEN and NOTE_READ. Is there any chance to get these
> kind of events?

They should be easy to add.. All you would need to do for NOTE_OPEN  
would be to add a vop_open_post  hook to VOP_OPEN that calls  
VFS_KNOTE_LOCKED(..., NOTE_OPEN). Similarly for read.

Take a look at how, for example, NOTE_CREATE is implemented  
(vop_create_post in sys/kern/vfs_subr.c) and how we add VOP hooks  
(sys/kern/vnode_if.src).

Why do you need these?

-- Suleiman


More information about the freebsd-hackers mailing list