wire / wire-format / inotify-event
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).
aka: inotify event structure
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).
| field | size | meaning |
|---|---|---|
| wd | 4 bytes (__s32) | Watch descriptor (identifies which inotify_add_watch). |
| mask | 4 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. |
| cookie | 4 bytes (__u32) | Cookie for pairing IN_MOVED_FROM and IN_MOVED_TO events. |
| len | 4 bytes (__u32) | Length of the name field (including NUL padding to sizeof(struct inotify_event) + len). |
| name | = len | Filename (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'
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/inotify-event
or /wire-format/inotify-event.json