"Creates a new inotify event queue. If NONBLOCKING is set (default),
the file descriptor is set to non-blocking I/O."
(let ((result (c-inotify-init)))
(when (minusp result)
(perror "inotify_init failed"))
"Creates a new inotify event queue. If NONBLOCKING is set (default),
the file descriptor is set to non-blocking I/O."
(let ((result (c-inotify-init)))
(when (minusp result)
(perror "inotify_init failed"))
-(defun make-unregistered-notify ()
- "Creates a new unregistered NOTIFY instance."
- (init-unregistered-notify (make-inotify-instance)))
+(defun make-unregistered-inotify ()
+ "Creates a new unregistered INOTIFY instance."
+ (init-unregistered-inotify (make-inotify-instance)))
"Adds PATHNAME (either of type PATHNAME or STRING) to be watched. FLAGS
determines how exactly (see inotify(7) for detailed information) and can
be of type LIST, KEYWORD or a raw numerical value (which isn't checked
"Adds PATHNAME (either of type PATHNAME or STRING) to be watched. FLAGS
determines how exactly (see inotify(7) for detailed information) and can
be of type LIST, KEYWORD or a raw numerical value (which isn't checked
-(defun make-notify (&optional (nonblocking T))
- "Creates a new registered NOTIFY instance. In NONBLOCKING mode, the file
-descriptor is set to non-blocking mode."
+(defun make-inotify (&optional (nonblocking T))
+ "Creates a new registered INOTIFY instance. In NONBLOCKING mode, the file
+descriptor is set to non-blocking mode. The resulting object has to be
+closed with CLOSE-INOTIFY."
-(defun watchedp (notify pathname)
- "Returns two values HANDLE and FLAGS if PATHNAME is being watched by NOTIFY,
-else NIL."
- (let ((it (gethash pathname (inotify-watched notify))))
+(defun watchedp (inotify pathname)
+ "Returns two values HANDLE and FLAGS if PATHNAME is being watched by INOTIFY,
+else NIL. The match is exact."
+ (let ((it (gethash pathname (inotify-watched Inotify))))
(check-type flags watch-flag-list)
;; now, :mask-add can't be member of flags
;; merge the flags
(check-type flags watch-flag-list)
;; now, :mask-add can't be member of flags
;; merge the flags
"Adds PATHNAME (either pathname or string) to be watched and records the
watched paths. FLAGS (a list of keywords) determines how exactly (see
inotify(7) for detailed information). Returns a handle which can be used
with UNWATCH. If REPLACE-P is set to T (default), the flags mask is
replaced rather than OR-ed to the current mask (if it exists). The
:MASK-ADD flag is therefore removed from the FLAGS argument."
"Adds PATHNAME (either pathname or string) to be watched and records the
watched paths. FLAGS (a list of keywords) determines how exactly (see
inotify(7) for detailed information). Returns a handle which can be used
with UNWATCH. If REPLACE-P is set to T (default), the flags mask is
replaced rather than OR-ed to the current mask (if it exists). The
:MASK-ADD flag is therefore removed from the FLAGS argument."
- (let* ((flags (sane-user-flags notify pathname flags :replace-p replace-p))
- (handle (watch-raw notify pathname flags)))
- (with-slots (watched) notify
+ (let* ((flags (sane-user-flags inotify pathname flags :replace-p replace-p))
+ (handle (watch-raw inotify pathname flags)))
+ (with-slots (watched) inotify
"Disables watching the path associated with the supplied HANDLE or PATHNAME."
(unless (or pathname handle)
(error "either PATHNAME or HANDLE has to be specified"))
(if handle
"Disables watching the path associated with the supplied HANDLE or PATHNAME."
(unless (or pathname handle)
(error "either PATHNAME or HANDLE has to be specified"))
(if handle
(unless handle
(error "PATHNAME ~S isn't being watched" pathname))
;; remove even if unwatch-raw throws an error (which can happen if :oneshot is specified)
(unless handle
(error "PATHNAME ~S isn't being watched" pathname))
;; remove even if unwatch-raw throws an error (which can happen if :oneshot is specified)
- (if (inotify-nonblocking notify)
- (not (unix-eagain-p (inotify-stream notify)))
- (listen (inotify-stream notify))))
+ (if (inotify-nonblocking inotify)
+ (not (unix-eagain-p (inotify-stream inotify)))
+ (listen (inotify-stream inotify))))
-(defmacro do-events ((var notify &key blocking-p) &body body)
- "Loops BODY with VAR bound to the next events retrieved from NOTIFY.
+(defmacro do-events ((var inotify &key blocking-p) &body body)
+ "Loops BODY with VAR bound to the next events retrieved from INOTIFY.
The macro uses NEXT-EVENT, so reading an event won't block and the loop
terminates if no events are available."
(check-type var symbol)
The macro uses NEXT-EVENT, so reading an event won't block and the loop
terminates if no events are available."
(check-type var symbol)
- with ,var and ,notify-sym = ,notify
+ with ,var and ,inotify-sym = ,inotify