diff options
| author | Paul Eggert | 2013-07-11 10:28:58 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-07-11 10:28:58 -0700 |
| commit | c8536ec4058302765b1259da83d5699b1e421c21 (patch) | |
| tree | fd13a7ecdb3eca4a3b7e487a74fd9b0a819d79b3 /src | |
| parent | 2d8484878bb98ff4af60e7d35500e4bd922a493d (diff) | |
| download | emacs-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/ChangeLog | 4 | ||||
| -rw-r--r-- | src/inotify.c | 31 |
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 @@ | |||
| 1 | 2013-07-11 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2013-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 | ||
| 74 | enum { uninitialized = -100 }; | ||
| 75 | /* File handle for inotify. */ | 74 | /* File handle for inotify. */ |
| 76 | static int inotifyfd = uninitialized; | 75 | static 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) | |||
| 268 | DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0, | 267 | DEFUN ("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 | ||
| 271 | A WATCH-DESCRIPTOR is returned on success. ASPECT might be one of the following | 270 | Return a watch descriptor. The watch will look for ASPECT events and |
| 272 | symbols or a list of those symbols: | 271 | invoke CALLBACK when an event occurs. |
| 272 | |||
| 273 | ASPECT might be one of the following symbols or a list of those symbols: | ||
| 273 | 274 | ||
| 274 | access | 275 | access |
| 275 | attrib | 276 | attrib |
| @@ -288,7 +289,7 @@ all-events or t | |||
| 288 | move | 289 | move |
| 289 | close | 290 | close |
| 290 | 291 | ||
| 291 | The following symbols can also be added to a list of aspects | 292 | The following symbols can also be added to a list of aspects: |
| 292 | 293 | ||
| 293 | dont-follow | 294 | dont-follow |
| 294 | excl-unlink | 295 | excl-unlink |
| @@ -296,9 +297,8 @@ mask-add | |||
| 296 | oneshot | 297 | oneshot |
| 297 | onlydir | 298 | onlydir |
| 298 | 299 | ||
| 299 | Watching a directory is not recursive. CALLBACK gets called in case of an | 300 | Watching a directory is not recursive. CALLBACK is passed a single argument |
| 300 | event. It gets passed a single argument EVENT which contains an event structure | 301 | EVENT which contains an event structure of the format |
| 301 | of 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; |