Crate inotify_sys

source ·
Expand description

inotify bindings for the Rust programming language

Please note that these are direct, low-level bindings to C functions that form the inotify C API. Unless you have a specific reason to use this crate, inotify-rs, which is an idiomatic wrapper, is a much better choice.


In general, inotify usage follows the following pattern:

  1. Create an inotify instance using inotify_init or inotify_init1.
  2. Manage watches with inotify_add_watch and inotify_rm_watch.
  3. Read event using read.
  4. Close the inotify instance using close, once you’re done.

Please refer to the inotify man page and the rest of this documentation for full details.


Describes a file system event


Event: File was accessed
Event: Any event occured
Event: Metadata was changed
Set the FD_CLOEXEC flag for an inotify instance
Event: File was closed
Event: Non-writable file or directory was closed
Event: Writable file was closed
Event: File or directory was created in watched directory
Event: File or directory in watched directory was deleted
Event: Watched file or directory was deleted
Don’t dereference path, if it is a symbolic link
Ignore events for children, that have been unlinked from watched directory
Indicates that a file system watch was removed
Indicates that the subject of an event is a directory
Update existing watch mask, instead of replacing it
Event: File was modified
Event: File or directory within watched directory was moved
Event: File or directory was moved out of watched directory
Event: File or directory was moved into watched directory
Event: Watched file or directory was moved
Set an inotify instance to non-blocking mode
Remove watch after one event
Only watch path, if it is a directory
Event: File or directory was opened
Indicates that the event queue has overflowed
Indicates that file system containing a watched object has been unmounted


Adds or updates an inotify watch
Creates an inotify instance
Creates an inotify instance
Removes an inotify watch