kqueue/kevent and directories (Was: Equivalent of POLLERR for kqueue.)

John-Mark Gurney gurney_j at resnet.uoregon.edu
Tue Dec 13 17:59:44 PST 2005


Vaclav Haisman wrote this message on Wed, Dec 14, 2005 at 01:12 +0100:
> On Tue, 13 Dec 2005, Vaclav Haisman wrote:
> 
> >Is there equivalent of POLLERR for kqueue()? Or is EV_EOF the only thing? 
> >I would like to use kqueue/kevent for sockets but error condition 
> >signaling is not clear to me from manpage.

It's up to the driver, but I don't believe that kqueue normally delivers
errors back to the process...  it returns as ready, but needs to be checked
manually via a call to the proper syscall...  (at least for sockets)..

> >Vaclav Haisman
> Another unclear area for me is how do changes in watched directory map on 
> NOTE_*s of EVFILT_VNODE filter. What NOTE_* do I get when a file is 
> created/deleted/modified etc.?

You basicly have to treat a directory as a normal file..  if a NOTE_WRITE
or NOTE_EXTEND gets returned on a directory, you have to rescan the
entire directory to see what changed...  kqueue does not return the
directory entry in a watched directory that change/added/removed..

> Is there some other documentation I can read besides the man page?

src/sys/kern/kern_event.c (and associated files)...

There is also jlemon's paper on kqueue:
http://people.freebsd.org/~jlemon/papers/kqueue.pdf

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-hackers mailing list