Convenient clojure functions providing linux-specific features via JNA
Convenient clojure functions providing linux-specific features via JNA
(add-iwatch inoti pathname flags handler)
Adds pathname to the watchlist of the given inotify object. Use the flags-mask macro to build flags, or pass in a collection of keywords (see flags-mask-fn for details). The handler function will be called when the given event occurs, with a single arg: a hash-map with keys like :flags (a set of keywords indicating the kind of event that occured), :name (for the name of the file updated when watching a directory), :cookie, etc. See inotify(7) man page for more details on each of these fields. The function will be called in the inotify reader thread, so it should complete promptly or coordinate with another thread to complete its work. Returns a watch descriptor that can safely be ignored unless you want to explicitly pass it to rm-iwatch later.
Adds pathname to the watchlist of the given inotify object. Use the flags-mask macro to build flags, or pass in a collection of keywords (see flags-mask-fn for details). The handler function will be called when the given event occurs, with a single arg: a hash-map with keys like :flags (a set of keywords indicating the kind of event that occured), :name (for the name of the file updated when watching a directory), :cookie, etc. See inotify(7) man page for more details on each of these fields. The function will be called in the inotify reader thread, so it should complete promptly or coordinate with another thread to complete its work. Returns a watch descriptor that can safely be ignored unless you want to explicitly pass it to rm-iwatch later.
(flags-mask & flags)
Returns a bit-mask number for the flags given. Valid flags are symbol forms of the flags listed in the inotify(7) man page. For example, use (flags-mask access) for IN_ACCESS. Throws an exception at compile time if invalid flags are given.
Returns a bit-mask number for the flags given. Valid flags are symbol forms of the flags listed in the inotify(7) man page. For example, use (flags-mask access) for IN_ACCESS. Throws an exception at compile time if invalid flags are given.
(flags-mask-fn flags)
Returns a bit-mask number for the flags collection given. Valid flags are keyword forms of the flags listed in the inotify(7) man page. For example, use :access for IN_ACCESS. Note you probably don't need to call this function directly: add-iwatch can take the same collection of flags, or you can use the flags-mask macro.
Returns a bit-mask number for the flags collection given. Valid flags are keyword forms of the flags listed in the inotify(7) man page. For example, use :access for IN_ACCESS. Note you probably don't need to call this function directly: add-iwatch can take the same collection of flags, or you can use the flags-mask macro.
(iclose inoti)
Closes down an inotify object. Blocks until the file descriptors are all closed and the agent has stopped looping.
Closes down an inotify object. Blocks until the file descriptors are all closed and the agent has stopped looping.
(iinit)
Creates a new inotify instance and returns an object representing it. Use add-iwatch to add files or directories to the watch list.
Creates a new inotify instance and returns an object representing it. Use add-iwatch to add files or directories to the watch list.
(rm-iwatch inoti wd)
Removes an item from the given inotify object's watchlist, as specified by the given watch descriptor.
Removes an item from the given inotify object's watchlist, as specified by the given watch descriptor.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close