kevent and related stuff

andi payn andi_payn at
Fri Oct 31 11:36:46 PST 2003

On Thu, 2003-10-30 at 22:33, Ruben de Groot wrote:
> On Thu, Oct 30, 2003 at 07:54:07AM -0800, andi payn typed:
> [...]
> > * I think (but I'm not sure) that kevent doesn't notify at all if the
> > only change to a file is its ATIME. If I'm right, this makes kevent
> > completely useless for fam. Adding a NOTE_ACCESS or something similar
> > would fix this. 

> Wouldn't NOTE_ATTRIB (EVFILT_VNODE) do what you want?

That was my first guess, but I first tested it with wait_on (before
sending the original email), and have since tested it directly, and
apparently you don't get NOTE_ATTRIB notifications just because the
ATIME changes.

As far as I can tell, there is no way to get notifications on only the
ATIME changing.

Now, if everyone seems to write the manpage as implying that NOTE_ATTRIB
should in fact get triggered by a change in the ATIME, maybe the right
solution is to make this true. However, I could easily see that breaking
existing code. That's why I suggested adding a new NOTE_ACCESS instead.

To see for yourself, here's the simplest possible test:
# touch /tmp/file
# ls -lu /tmp/file
-rw-------  1 andi  users  0 Oct 31 11:29 /tmp/file
# wait_on -h /tmp/file > /tmp/out &
# cat /tmp/file
# cat /tmp/out
# ls -lu /tmp/file
-rw-------  1 andi  users  0 Oct 31 11:30 /tmp/file
# touch /tmp/file
[1]+  Exit 4     wait_on -h /tmp/file > /tmp/out
# cat /tmp/out
/tmp/file: attributed

In other words, changing the ATIME (e.g., with cat) does not trigger
NOTE_ATTRIB; changing the MTIME (e.g., with touch), does.

More information about the freebsd-hackers mailing list