description

Inotify is a linux kernel subsystem, that notice changes to the filesystem, and report those changes to applications.

The interface provide a OCaml program to use easily inotify.

download

documentation

The interface is very easy to use, and almost like the C library.

exception Error of string * int

type select_event =
| S_Access
| S_Attrib
| S_Close_write
| S_Close_nowrite
| S_Create
| S_Delete
| S_Delete_self
| S_Modify
| S_Move_self
| S_Moved_from
| S_Moved_to
| S_Open
| S_Dont_follow
| S_Mask_add
| S_Oneshot
| S_Onlydir
| S_Move
| S_Close
| S_All

type type_event =
| Access
| Attrib
| Close_write
| Close_nowrite
| Create
| Delete
| Delete_self
| Modify
| Move_self
| Moved_from
| Moved_to
| Open
| Ignored
| Isdir
| Q_overflow
| Unmount

type wd
type event = wd * type_event list * int32 * string option

val string_of_event : type_event -> string
val int_of_wd : wd -> int

val init : unit -> Unix.file_descr
val add_watch : Unix.file_descr -> string -> select_event list -> wd
val rm_watch : Unix.file_descr -> wd -> unit
val read : Unix.file_descr -> (int * type_event list * int32 * string option) list

Changelog

  • 1.0: Add proper Inotify.Error exception with useful information instead of using caml_failwith.
  • 0.9: Fix a bug related to offset in the buf introduced during previous changes.
  • 0.8: Fix string to not contains the trailing null that inotify add to keep structure address-aligned. found by Gregory Bellier.
  • 0.7: some buildings fixes by Sylvain Le Gall, and few others fixes
  • 0.6: license mixup fixed. now correclty reference LGPL 2.1 everywhere
  • 0.5: Improve installation/deinstallation of the package with ocamlfind
  • 0.4: Add a compat layer for old glibc (< 2.4)
  • 0.3: Abstract wd type, and add a int_of_wd conversion function
  • 0.2: few fixes in types, and add a mli file
  • 0.1: initial implementation.