aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inotify.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/inotify.c b/src/inotify.c
index a084552adcb..470b60ba893 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -61,7 +61,7 @@ static int inotifyfd = -1;
61 IN_ONLYDIR 61 IN_ONLYDIR
62 62
63 Format: (descriptor . ((id filename callback mask) ...)) 63 Format: (descriptor . ((id filename callback mask) ...))
64 */ 64*/
65static Lisp_Object watch_list; 65static Lisp_Object watch_list;
66 66
67static Lisp_Object 67static Lisp_Object
@@ -204,9 +204,10 @@ inotifyevent_to_event (Lisp_Object watch, struct inotify_event const *ev)
204 204
205/* Add a new watch to watch-descriptor WD watching FILENAME and using 205/* Add a new watch to watch-descriptor WD watching FILENAME and using
206 CALLBACK. Returns a cons (DESCRIPTOR . ID) uniquely identifying the 206 CALLBACK. Returns a cons (DESCRIPTOR . ID) uniquely identifying the
207 new watch. */ 207 new watch. */
208static Lisp_Object 208static Lisp_Object
209add_watch (int wd, Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback) 209add_watch (int wd, Lisp_Object filename,
210 Lisp_Object aspect, Lisp_Object callback)
210{ 211{
211 Lisp_Object descriptor = make_number (wd); 212 Lisp_Object descriptor = make_number (wd);
212 Lisp_Object elt = Fassoc (descriptor, watch_list); 213 Lisp_Object elt = Fassoc (descriptor, watch_list);
@@ -260,7 +261,7 @@ remove_descriptor (Lisp_Object descriptor, bool invalid_p)
260 } 261 }
261} 262}
262 263
263/* Remove watch associated with (descriptor, id). */ 264/* Remove watch associated with (descriptor, id). */
264static void 265static void
265remove_watch (Lisp_Object descriptor, Lisp_Object id) 266remove_watch (Lisp_Object descriptor, Lisp_Object id)
266{ 267{
@@ -273,7 +274,7 @@ remove_watch (Lisp_Object descriptor, Lisp_Object id)
273 if (! NILP (watch)) 274 if (! NILP (watch))
274 XSETCDR (elt, Fdelete (watch, XCDR (elt))); 275 XSETCDR (elt, Fdelete (watch, XCDR (elt)));
275 276
276 /* Remove the descriptor if noone is watching it. */ 277 /* Remove the descriptor if noone is watching it. */
277 if (NILP (XCDR (elt))) 278 if (NILP (XCDR (elt)))
278 remove_descriptor (descriptor, false); 279 remove_descriptor (descriptor, false);
279 } 280 }
@@ -378,13 +379,12 @@ unmount
378 379
379If a directory is watched then NAME is the name of file that caused the event. 380If a directory is watched then NAME is the name of file that caused the event.
380 381
381COOKIE is an object that can be compared using `equal' to identify two matchingt 382COOKIE is an object that can be compared using `equal' to identify two matching
382renames (moved-from and moved-to). 383renames (moved-from and moved-to).
383 384
384See inotify(7) and inotify_add_watch(2) for further information. The inotify fd 385See inotify(7) and inotify_add_watch(2) for further information. The inotify fd
385is managed internally and there is no corresponding inotify_init. Use 386is managed internally and there is no corresponding inotify_init. Use
386`inotify-rm-watch' to remove a watch. 387`inotify-rm-watch' to remove a watch. */)
387 */)
388 (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback) 388 (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback)
389{ 389{
390 Lisp_Object encoded_file_name; 390 Lisp_Object encoded_file_name;
@@ -417,8 +417,7 @@ DEFUN ("inotify-rm-watch", Finotify_rm_watch, Sinotify_rm_watch, 1, 1, 0,
417 417
418WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. 418WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'.
419 419
420See inotify_rm_watch(2) for more information. 420See inotify_rm_watch(2) for more information. */)
421 */)
422 (Lisp_Object watch_descriptor) 421 (Lisp_Object watch_descriptor)
423{ 422{
424 423
@@ -462,13 +461,13 @@ it invalid. */)
462 461
463#ifdef INOTIFY_DEBUG 462#ifdef INOTIFY_DEBUG
464DEFUN ("inotify-watch-list", Finotify_watch_list, Sinotify_watch_list, 0, 0, 0, 463DEFUN ("inotify-watch-list", Finotify_watch_list, Sinotify_watch_list, 0, 0, 0,
465 doc: /* Return a copy of the internal watch_list. */) 464 doc: /* Return a copy of the internal watch_list. */)
466{ 465{
467 return Fcopy_sequence (watch_list); 466 return Fcopy_sequence (watch_list);
468} 467}
469 468
470DEFUN ("inotify-allocated-p", Finotify_allocated_p, Sinotify_allocated_p, 0, 0, 0, 469DEFUN ("inotify-allocated-p", Finotify_allocated_p, Sinotify_allocated_p, 0, 0, 0,
471 doc: /* Return non-nil, if a inotify instance is allocated. */) 470 doc: /* Return non-nil, if a inotify instance is allocated. */)
472{ 471{
473 return inotifyfd < 0 ? Qnil : Qt; 472 return inotifyfd < 0 ? Qnil : Qt;
474} 473}