tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kevent monitoring of file system changes

I have been looking at using kevent to monitor writes to file in order to 
detect and stream any changes.
I have compiled and run the code given in the kevent man page on NetBSD-8 and 
NetBSD-9.1 and it seems to work OK, but I have a few questions :-)
1) If I am monitoring a file, for example, called 'a' and I copy another file 
over it then I get a write event and an extend event. If I copy the same file 
over it again I would have thought I should just get a write event as the file 
size would be the same (no need to extend), but I find that I still get both 
events reported. The same is true if the target is overwritten with a smaller 

2) If I remove the NOTE_EXTEND attribute from the list of monitored events 
then I would expect the extension events to stop being reported, however this 
is not the case - they still keep coming. This seems to be counter intuitive!
Any comments before I grovel in the kernel source...

Home | Main Index | Thread Index | Old Index