Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Inotify
SourceInotify binding for OCaml
Type of event masks.
Type of observed events.
Type of watch descriptors.
Type of received events, corresponding to struct inotify_event
. In event wd, kinds, cookie, path
, wd
corresponds to inotify_event.wd
, kinds
corresponds to the bits set in inotify_event.mask
, cookie
corresponds to inotify_event.cookie
, path
is Some filename
if inotify_event.len > 0
and None
otherwise.
int_of_watch wd
returns the underlying integer representation of watch descriptor wd
.
string_of_event_kind ek
returns the string representation of event kind ek
, e.g. string_of_event_kind Move_self
≡ "MOVE_SELF"
.
string_of_event event
returns the string representation of event ev
, e.g. string_of_event
create ()
returns a fresh inotify file descriptor or raises Unix.Unix_error(errno, "inotify_init", "")
.
add_watch fd path events
starts observing events from events
for path path
at inotify file descriptor fd
and returns a fresh watch descriptor, or raises Unix.Unix_error(errno, "inotify_add_watch", path)
.
rm_watch fd watch
stops observing events corresponding to watch descriptor watch
at inotify file descriptor fd
, or raises Unix.Unix_error(errno, "inotify_rm_watch", path)
.
read fd
requests a list of events for inotify file descriptor fd
. Each event will include the watch descriptor, which can be used to determine the path that caused it, and Moved_to
and Moved_from
events will include a cookie that allows to associate them with each other.
If read
is not called often enough, the kernel event buffer may overflow, in which case the event kind list will consist of [Q_overflow]
. Such an event would be associated with a watch descriptor -1
, never returned from add_watch
.