summaryrefslogtreecommitdiff
path: root/src/inotify.c
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2016-01-22 19:56:09 +0100
committerMichael Albinus <michael.albinus@gmx.de>2016-01-22 19:56:09 +0100
commit7bf54d01159eb09bae3c9cd86f2af0812d9afdf6 (patch)
treef00e00ba1ed5a492ec94faf8d07a6ca2f857a9c5 /src/inotify.c
parentf7dc6d8b5bb318e02a4016d93f8b34de0716f4dc (diff)
downloademacs-7bf54d01159eb09bae3c9cd86f2af0812d9afdf6.tar.gz
emacs-7bf54d01159eb09bae3c9cd86f2af0812d9afdf6.tar.bz2
emacs-7bf54d01159eb09bae3c9cd86f2af0812d9afdf6.zip
Backport kqueue integration from master
* configure.ac (--with-file-notification): Add kqueue. (top): Remove special test for "${HAVE_NS}" and ${with_file_notification}, this is handled inside gfilenotify tests. Add kqueue tests. Use NOTIFY_CFLAGS and NOTIFY_LIBS instead of library specific variables. Add error message for gfile on Nextstep. * doc/lispref/os.texi (File Notifications): Add kqueue as backend. Fix some glitches in the example. * etc/NEWS: Mention kqueue. * lisp/filenotify.el (file-notify--library) (file-notify-descriptors, file-notify-callback) (file-notify-add-watch, file-notify-rm-watch) (file-notify-valid-p): Add kqueue support. (file-notify--rm-descriptor): Remove WHAT arg. * src/Makefile.in: Use NOTIFY_CFLAGS and NOTIFY_LIBS. * src/emacs.c (main): Call globals_of_kqueue and syms_of_kqueue. * src/inotify.c (inotifyevent_to_event): Extract file name from watch_object if the event doesn't provide it. (Finotify_add_watch): Add file name to watch_object. * src/keyboard.c (make_lispy_event): Check also for HAVE_KQUEUE. * src/kqueue.c: New file. * src/lisp.h: Declare extern globals_of_kqueue and syms_of_kqueue. * test/automated/file-notify-tests.el (file-notify--test-expected-events): Remove. (file-notify--test-cleanup): Do not set that variable. (file-notify--test-timeout) Use different timeouts for different libraries. (file-notify--test-library): New defun. (file-notify--test-event-test): Make stronger checks. (file-notify--test-with-events): EVENTS can also be a list of lists. Flush outstanding events before running the body. Make timeout heuristically depend on the number of events. (file-notify-test01-add-watch, file-notify-test02-events) (file-notify-test04-file-validity, file-notify-test05-dir-validity): Rewrite in order to call file monitors but directory monitors. (file-notify-test02-events, file-notify-test04-file-validity): Do not skip cygwin tests. Add additional test for file creation. Adapt expected result for different backends. (file-notify-test03-autorevert): Some of the tests don't work for w32notify. (file-notify-test06-many-events): New test.
Diffstat (limited to 'src/inotify.c')
-rw-r--r--src/inotify.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/inotify.c b/src/inotify.c
index 47652ff35bd..e0619e584f7 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -46,8 +46,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
static int inotifyfd = -1;
/* Assoc list of files being watched.
- Format:
- (watch-descriptor . callback)
+ Format: (watch-descriptor name callback)
*/
static Lisp_Object watch_list;
@@ -106,12 +105,14 @@ inotifyevent_to_event (Lisp_Object watch_object, struct inotify_event const *ev)
name = make_unibyte_string (ev->name, min (len, ev->len));
name = DECODE_FILE (name);
}
+ else
+ name = XCAR (XCDR (watch_object));
return list2 (list4 (make_watch_descriptor (ev->wd),
mask_to_aspects (ev->mask),
name,
make_number (ev->cookie)),
- XCDR (watch_object));
+ Fnth (make_number (2), watch_object));
}
/* This callback is called when the FD is available for read. The inotify
@@ -325,7 +326,7 @@ is managed internally and there is no corresponding inotify_init. Use
watch_list = Fdelete (watch_object, watch_list);
/* Store watch object in watch list. */
- watch_object = Fcons (watch_descriptor, callback);
+ watch_object = list3 (watch_descriptor, encoded_file_name, callback);
watch_list = Fcons (watch_object, watch_list);
return watch_descriptor;