Structure that describes a watched filesystem event
Synopsis:
#include <sys/inotify.h>
struct inotify_event {
int32_t wd;
uint32_t mask;
uint32_t cookie;
uint32_t len;
char name[0];
};
Description:
The inotify_event structure describes a filesystem event returned by the inotify system.
You get these events by reading the file descriptor returned by
inotify_init().
The members of this structure include:
- wd
- The watch descriptor associated with the event, as returned by
inotify_add_watch().
- mask
- A bitmask that includes the event type:
- IN_ACCESS — the file was read.
- IN_MODIFY — the file was written to.
- IN_ATTRIB — the attributes of the file changed.
- IN_CLOSE_WRITE — a file that was opened for writing was closed.
- IN_CLOSE_NOWRITE — a file that was opened not for writing was closed.
- IN_OPEN — the file was opened.
- IN_MOVED_FROM — the file was moved or renamed away from the item being watched.
- IN_MOVED_TO — the file was moved or renamed to the item being watched.
- IN_CREATE — a file was created in a watched directory.
- IN_DELETE — a file or directory was deleted.
- IN_DELETE_SELF — the file or directory being monitored was deleted.
- IN_MOVE_SELF — the file or directory being monitored was moved or renamed.
along with other information:
- IN_UNMOUNT — the backing filesystem was unmounted.
- IN_Q_OVERFLOW — the inotify queue overflowed.
- IN_IGNORED — the watch was automatically removed because the file was
deleted, or its filesystem was unmounted.
- IN_ISDIR — the event occurred against a directory.
- cookie
- An unique number that identifies related events.
For example, if you're watching two directories, and a file is moved from one of the
directories into the other, you get two separate events:
an IN_MOVED_FROM for one watched directory, and an
IN_MOVED_TO for the other.
Both events have the same cookie value, to indicate that they're related.
- len
- The length of the name field, including any required padding.
- name
- The name of the object that the event occurred to.
While the QNX Neutrino inotify implementation follows the same semantics as
the Linux implementation, the behavior differs from Linux due to the kernel and filesystem
models employed.
For an overview of inotify, see http://www.linuxjournal.com/article/8478?page=0,0 in the Linux Journal. Currently,
only io-blk.so-based filesystems support inotify.