Module inotify::ffi [] [src]

Bindings for inotify

There are four types of statics:

  • Flags, to be passed to inotify_init1();
  • Events, that describe which events should be watched for (when calling inotify_add_watch()), and which event has occured (when returned by read());
  • Options, which can be added to the bit mask passed to inotify_add_watch(), to change default behavior;
  • Infos, indicating further details of the event that occured (returned by read()).

When events occur for monitored files and directories, those events are made available to the application as structured data that can be read from the inotify file descriptor using read().

When all file descriptors referring to an inotify instance have been closed (using close()), the underlying object and its resources are freed for reuse by the kernel; all associated watches are automatically freed.

A programmer wanting to use inotify should also carefully read through the inotify(7) man page, which contains many caveats, warnings, and recommendations for proper, robust, and efficient usage of inotify.

Structs

inotify_event

Describes an event.

Constants

IN_ACCESS

Event: File was accessed.

IN_ALL_EVENTS

Event: Any event occured.

IN_ATTRIB

Event: Metadata has changed.

IN_CLOEXEC

Flag: Set the FD_CLOEXEC flag

IN_CLOSE

Event: File opened was closed.

IN_CLOSE_NOWRITE

Event: File not opened for writing was closed.

IN_CLOSE_WRITE

Event: File opened for writing was closed.

IN_CREATE

Event: File or directory was created.

IN_DELETE

Event: File or directory was deleted.

IN_DELETE_SELF

Event: Watched file or directory was deleted.

IN_DONT_FOLLOW

Option: Don't dereference (if self is a symlink).

IN_EXCL_UNLINK

Option: Don't watch unlinked children.

IN_IGNORED

Info: Watch was removed.

IN_ISDIR

Info: Subject of this event is a directory.

IN_MASK_ADD

Option: Add events to an existing watch instead of replacing it.

IN_MODIFY

Event: File was modified.

IN_MOVE

Event: File or directory was moved away or in.

IN_MOVED_FROM

Event: File or directory was moved away.

IN_MOVED_TO

Event: File or directory was moved in.

IN_MOVE_SELF

Event: Watched file or directory was moved.

IN_NONBLOCK

Flag: Set the O_NONBLOCK file status flag

IN_ONESHOT

Option: Listen for one event, then remove the watch.

IN_ONLYDIR

Option: Don't watch children (if self is a directory).

IN_OPEN

Event: File was opened.

IN_Q_OVERFLOW

Info: Event queue overflowed.

IN_UNMOUNT

Info: Filesystem containing self was unmounted.

Functions

close
inotify_add_watch

Manipulates the "watch list" associated with an inotify instance.

inotify_init

Creates an inotify instance.

inotify_init1

Creates an inotify instance.

inotify_rm_watch

Removes an item from an inotify watch list.

read