[][src]Module nix::sys::inotify

Monitoring API for filesystem events.

Inotify is a Linux-only API to monitor filesystems events.

For more documentation, please read inotify(7).

Examples

Monitor all events happening in directory "test":

// We create a new inotify instance.
let instance = Inotify::init(InitFlags::empty()).unwrap();

// We add a new watch on directory "test" for all events.
let wd = instance.add_watch("test", AddWatchFlags::IN_ALL_EVENTS).unwrap();

loop {
    // We read from our inotify instance for events.
    let events = instance.read_events().unwrap();
    println!("Events: {:?}", events);
}

Structs

AddWatchFlags

Configuration options for inotify_add_watch.

InitFlags

Configuration options for inotify_init1.

Inotify

An inotify instance. This is also a file descriptor, you can feed it to other interfaces consuming file descriptors, epoll for example.

InotifyEvent

A single inotify event.

WatchDescriptor

This object is returned when you create a new watch on an inotify instance. It is then returned as part of an event once triggered. It allows you to know which watch triggered which event.