kevent and related stuff

John-Mark Gurney gurney_j at efn.org
Mon Nov 10 00:56:44 PST 2003


andi payn wrote this message on Thu, Oct 30, 2003 at 07:54 -0800:
> * The kevent mechanism doesn't monitor directories in a sufficient way
> to make fam happy. If you change a file in a directory that you're
> watching, unlike imon or dnotify, kevent won't see anything worth
> reporting at all. This means that for directory monitoring, kevent is
> useless as-is. Again, if I wanted to patch kevent to provide this
> additional notification, would others want this?

This is to prevent running out of memory.. one of the great advantages
of kqueue's is that all memory necessary is allocated at the time the
event is posted.  If kevent successfully set your event, then you know
you'll get all instances of the event.

The problem with putting a notify on a directory and having it watch
the children is that file's ATIMES change w/o the directory knowing
about it.  Are you suggesting that files start to know which directory
they are located in?  What happens when you link the same file into the
directory thousands of times?  Do you get the one notification or
thousands of notifications?

The solution to that is to open each file in the directory, and monitor
that.  You also monitor the directory for changes to get notified of
any new or removed files.

As for getting notified of atime, etc, it shouldn't be hard to add a
VN_KNOTE(vp, NOTE_ATTRIB); to ufs_itimes, though you should only post
it if any of the three times get modified.

-- 
  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