aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-07-11 10:28:58 -0700
committerPaul Eggert2013-07-11 10:28:58 -0700
commitc8536ec4058302765b1259da83d5699b1e421c21 (patch)
treefd13a7ecdb3eca4a3b7e487a74fd9b0a819d79b3 /src
parent2d8484878bb98ff4af60e7d35500e4bd922a493d (diff)
downloademacs-c8536ec4058302765b1259da83d5699b1e421c21.tar.gz
emacs-c8536ec4058302765b1259da83d5699b1e421c21.zip
* inotify.c (uninitialized): Remove. All uses replaced by -1.
(Finotify_add_watch): Simplify, since -1 means uninitialized now. Touch up doc a bit.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/inotify.c31
2 files changed, 18 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7b54b6195a9..04d5a024672 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12013-07-11 Paul Eggert <eggert@cs.ucla.edu> 12013-07-11 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * inotify.c (uninitialized): Remove. All uses replaced by -1.
4 (Finotify_add_watch): Simplify, since -1 means uninitialized now.
5 Touch up doc a bit.
6
3 * eval.c (backtrace_function, backtrace_args): Now EXTERNALLY_VISIBLE. 7 * eval.c (backtrace_function, backtrace_args): Now EXTERNALLY_VISIBLE.
4 This is for .gdbinit xbacktrace. 8 This is for .gdbinit xbacktrace.
5 9
diff --git a/src/inotify.c b/src/inotify.c
index 01fb34a5c4a..0bbcd443332 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -71,9 +71,8 @@ static Lisp_Object Qunmount; /* IN_UNMOUNT */
71# define IN_ONLYDIR 0 71# define IN_ONLYDIR 0
72#endif 72#endif
73 73
74enum { uninitialized = -100 };
75/* File handle for inotify. */ 74/* File handle for inotify. */
76static int inotifyfd = uninitialized; 75static int inotifyfd = -1;
77 76
78/* Assoc list of files being watched. 77/* Assoc list of files being watched.
79 Format: 78 Format:
@@ -268,8 +267,10 @@ aspect_to_inotifymask (Lisp_Object aspect)
268DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0, 267DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0,
269 doc: /* Add a watch for FILE-NAME to inotify. 268 doc: /* Add a watch for FILE-NAME to inotify.
270 269
271A WATCH-DESCRIPTOR is returned on success. ASPECT might be one of the following 270Return a watch descriptor. The watch will look for ASPECT events and
272symbols or a list of those symbols: 271invoke CALLBACK when an event occurs.
272
273ASPECT might be one of the following symbols or a list of those symbols:
273 274
274access 275access
275attrib 276attrib
@@ -288,7 +289,7 @@ all-events or t
288move 289move
289close 290close
290 291
291The following symbols can also be added to a list of aspects 292The following symbols can also be added to a list of aspects:
292 293
293dont-follow 294dont-follow
294excl-unlink 295excl-unlink
@@ -296,9 +297,8 @@ mask-add
296oneshot 297oneshot
297onlydir 298onlydir
298 299
299Watching a directory is not recursive. CALLBACK gets called in case of an 300Watching a directory is not recursive. CALLBACK is passed a single argument
300event. It gets passed a single argument EVENT which contains an event structure 301EVENT which contains an event structure of the format
301of the format
302 302
303(WATCH-DESCRIPTOR ASPECTS NAME COOKIE) 303(WATCH-DESCRIPTOR ASPECTS NAME COOKIE)
304 304
@@ -331,16 +331,13 @@ is managed internally and there is no corresponding inotify_init. Use
331 331
332 CHECK_STRING (file_name); 332 CHECK_STRING (file_name);
333 333
334 if (inotifyfd == uninitialized) 334 if (inotifyfd < 0)
335 { 335 {
336 inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC); 336 inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC);
337 if (inotifyfd == -1) 337 if (inotifyfd < 0)
338 { 338 xsignal1
339 inotifyfd = uninitialized; 339 (Qfile_notify_error,
340 xsignal1 340 build_string ("File watching feature (inotify) is not available"));
341 (Qfile_notify_error,
342 build_string ("File watching feature (inotify) is not available"));
343 }
344 watch_list = Qnil; 341 watch_list = Qnil;
345 add_read_fd (inotifyfd, &inotify_callback, NULL); 342 add_read_fd (inotifyfd, &inotify_callback, NULL);
346 } 343 }
@@ -392,7 +389,7 @@ See inotify_rm_watch(2) for more information.
392 { 389 {
393 close (inotifyfd); 390 close (inotifyfd);
394 delete_read_fd (inotifyfd); 391 delete_read_fd (inotifyfd);
395 inotifyfd = uninitialized; 392 inotifyfd = -1;
396 } 393 }
397 394
398 return Qt; 395 return Qt;