wire / wire-format / inotify-event

inotify event structure

An inotify event returned by read(2) on an inotify file descriptor: wd (watch descriptor), mask (event mask), cookie (for rename pairing), len (length of the name field), then a NUL-terminated filename (if the watched path is a directory).

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: inotify event structure

wire format

spec: Linux kernel (inotify)

An inotify event returned by read(2) on an inotify file descriptor: wd (watch descriptor), mask (event mask), cookie (for rename pairing), len (length of the name field), then a NUL-terminated filename (if the watched path is a directory).

fieldsizemeaning
wd4 bytes (__s32)Watch descriptor (identifies which inotify_add_watch).
mask4 bytes (__u32)Event mask: IN_ACCESS, IN_MODIFY, IN_ATTRIB, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, IN_OPEN, IN_MOVED_FROM, IN_MOVED_TO, IN_CREATE, IN_DELETE, IN_DELETE_SELF, IN_MOVE_SELF, IN_UNMOUNT, IN_Q_OVERFLOW, IN_IGNORED.
cookie4 bytes (__u32)Cookie for pairing IN_MOVED_FROM and IN_MOVED_TO events.
len4 bytes (__u32)Length of the name field (including NUL padding to sizeof(struct inotify_event) + len).
name= lenFilename (NUL-terminated, padded to 4-byte alignment). Present only if the watched path is a directory.

example:

01 00 00 00 00 08 00 00 00 00 00 00 08 00 00 00 66 6f 6f 00 00 00 00 00

inotify event: wd 1, mask IN_CREATE (0x00000100), cookie 0, len 8, name 'foo'


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/inotify-event or /wire-format/inotify-event.json