This library provides an interface to the Linux inotify API that
generates events for changes to the file system. The interface exposes a
high level interface that is built on top of a complete encapsulation of
the low-level Linux inotify API. The high level interface maintains an
admin of watched locations and translates the events to the physical
file locations.
- inotify_init(-INotify, +Options) is det
- Create an INotify object. Options is currently ignored.
- inotify_close(+INotify) is det
- Close an INotify object.
- inotify_add_watch(+INotify, +Path, +Options) is det
- Add a watch for Path. Path is refers to either a file or directory
and may be a term suitable for absolute_file_name/3. Options is a
list of atoms that create the watch mask. These options are
documented with
inotify(7)
. The Prolog version is derived from the C
macro name (e.g., IN_CLOSE_WRITE) by dropping IN_ and turning the
remainder to lower case (e.g., close_write
). Using all
watches
for all events.
- inotify_rm_watch(+INotify, +Watch) is semidet
- Remove the indicated watch. Watch is either the integer watch id, an
absolute path or a path specification used for inotify_add_watch/3.
@see inotify_current_watch/2.
- inotify_current_watch(?INotify, ?Path) is nondet
- True if Path is watched by INotify.
- inotify_read_event(+INotify, -Event, +Options) is semidet
- Read and event from an INotify object. Event is a term
Action(Object), where Object is one of
file(File)
or
directory(Directory)
and action is one of:
- access
- File was accessed
- attrib
- File metadata changed
- close_write
- File opened for writing was closed.
- close_nowrite
- File or directory not opened for writing was closed.
- create
- File/directory created in watched directory.
- delete
- File/directory deleted from watched directory.
- delete_self
- Watched file/directory was itself deleted. The target is
automatically removed from the watched targets.
- modify
- File was modified (e.g.,
write(2)
, truncate(2)
).
- move_self
- Watched file/directory was itself moved. Unfortunately the
interface doesn't tell us where the directory or file moved
to. As a result, inotify_current_watch/2 indicates the old
location and all reported events keep indicating the old
location.
- moved_from
- Generated for the directory containing the old filename when
a file is renamed.
- moved_to
- Generated for the directory containing the new filename when
a file is renamed.
- open
- File or directory was opened.