package inotify

  1. Overview
  2. Docs
Inotify bindings for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

inotify-2.6.tbz
sha256=1d103e7dd32fddd0f1201b2d2f6c5b762548277bc173beef7b072f30ea89ccc4
sha512=660a44e3083f76f0342a6214ba9df4e18b42cc5da833cae3200345e5f0c5c353a3d67dace21ba00d3365d6866a82c90e5b732c9f8e3d9e38687239d6d0fe41f5

doc/inotify/Inotify/index.html

Module InotifySource

Inotify binding for OCaml

Sourcetype selector =
  1. | S_Access
  2. | S_Attrib
  3. | S_Close_write
  4. | S_Close_nowrite
  5. | S_Create
  6. | S_Delete
  7. | S_Delete_self
  8. | S_Modify
  9. | S_Move_self
  10. | S_Moved_from
  11. | S_Moved_to
  12. | S_Open
  13. | S_Dont_follow
  14. | S_Mask_add
  15. | S_Oneshot
  16. | S_Onlydir
  17. | S_Move
  18. | S_Close
  19. | S_All

Type of event masks.

Sourcetype event_kind =
  1. | Access
  2. | Attrib
  3. | Close_write
  4. | Close_nowrite
  5. | Create
  6. | Delete
  7. | Delete_self
  8. | Modify
  9. | Move_self
  10. | Moved_from
  11. | Moved_to
  12. | Open
  13. | Ignored
  14. | Isdir
  15. | Q_overflow
  16. | Unmount

Type of observed events.

Sourcetype watch

Type of watch descriptors.

Sourcetype event = watch * event_kind list * int32 * string option

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.

Sourceval int_of_watch : watch -> int

int_of_watch wd returns the underlying integer representation of watch descriptor wd.

Sourceval string_of_event_kind : event_kind -> string

string_of_event_kind ek returns the string representation of event kind ek, e.g. string_of_event_kind Move_self"MOVE_SELF".

Sourceval string_of_event : event -> string

string_of_event event returns the string representation of event ev, e.g. string_of_event

Sourceval create : unit -> Unix.file_descr

create () returns a fresh inotify file descriptor or raises Unix.Unix_error(errno, "inotify_init", "").

Sourceval add_watch : Unix.file_descr -> string -> selector list -> watch

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).

Sourceval rm_watch : Unix.file_descr -> watch -> unit

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).

Sourceval read : Unix.file_descr -> event list

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.

OCaml

Innovation. Community. Security.