Bug 192239

Summary: NOTE_TRUNCATE not supported
Product: Base System Reporter: ericshane
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Works As Intended    
Severity: Affects Some People CC: asomers
Priority: --- Keywords: feature
Version: 10.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
a minimal program for printing VNODE events on BSD none

Description ericshane 2014-07-29 13:22:47 UTC
Created attachment 145120 [details]
a minimal program for printing VNODE events on BSD

On OpenBSD /usr/include/sys/event.h defines a filer for watching responding file truncation:

#define·NOTE_TRUNCATE   0x0080       /* vnode was truncated */

On FreeBSD this is not defined, and does not appear to be covered by any other filers

$ echo "test" > file.txt # NOTE_WRITE
$ : > file.txt           # NOTE_TRUNCATE

I'm filing this bug on behalf of the entr utility (http://entrproject.org) since this leaves an edge case where a file is altered without triggering an action.
Comment 1 ericshane 2025-01-23 15:12:21 UTC
I tested this program on FreeBSD 14.2, and observed that the TRUNCATE event works

 $ ./a.out
event 1/1: flags: 0x20 fflags: 0x6
event 1/1: flags: 0x20 fflags: 0x8

Closing!