tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kevent monitoring of file system changes
On Sunday 14 Mar 2021 18:29:58 Mouse wrote:
> > 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 file!
>
> Most file copy programs open the target with O_TRUNC, then write. THis
> means that the target is always being extended, since it is truncated
> to zero size as of the open().
>
> Does it still work the same way if you copy using dd conv=notrunc?
> (That's one of the few ways in the stock system to copy a file's
> contents without truncating the target first.)
>
> > 2) If I remove the NOTE_EXTEND attribute from the list [...]
>
> No idea here. I don't really know kevent.
>
Thank you - I hadn't though about copy using O_TRUNC!
Testing with dd conv=notrunc showed just writes if the file being copied over
was equal or less than the size of the existing file. Problem 1 explained,
I'll have a look in kevent.c and fathom out what's going.
Thanks again,
Dave
Home |
Main Index |
Thread Index |
Old Index