mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 11:23:24 +00:00
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
This commit is contained in:
commit
dd0994aa36
2 changed files with 44 additions and 35 deletions
42
configure.ac
42
configure.ac
|
@ -4129,26 +4129,28 @@ case $with_file_notification,$NOTIFY_OBJ in
|
||||||
fi ;;
|
fi ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
dnl kqueue is available on BSD-like systems.
|
AS_IF([test "$opsys" != "haiku"], [
|
||||||
case $with_file_notification,$NOTIFY_OBJ in
|
dnl kqueue is available on BSD-like systems and Haiku, but Haiku's
|
||||||
kqueue,* | yes,)
|
dnl implementation cannot monitor filesystem activity.
|
||||||
EMACS_CHECK_MODULES([KQUEUE], [libkqueue])
|
case $with_file_notification,$NOTIFY_OBJ in
|
||||||
if test "$HAVE_KQUEUE" = "yes"; then
|
kqueue,* | yes,)
|
||||||
AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
|
EMACS_CHECK_MODULES([KQUEUE], [libkqueue])
|
||||||
CPPFLAGS="$CPPFLAGS -I/usr/include/kqueue"
|
if test "$HAVE_KQUEUE" = "yes"; then
|
||||||
NOTIFY_CFLAGS=$KQUEUE_CFLAGS
|
AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
|
||||||
NOTIFY_LIBS=$KQUEUE_LIBS
|
CPPFLAGS="$CPPFLAGS -I/usr/include/kqueue"
|
||||||
NOTIFY_OBJ=kqueue.o
|
NOTIFY_CFLAGS=$KQUEUE_CFLAGS
|
||||||
NOTIFY_SUMMARY="yes -lkqueue"
|
NOTIFY_LIBS=$KQUEUE_LIBS
|
||||||
else
|
NOTIFY_OBJ=kqueue.o
|
||||||
AC_SEARCH_LIBS([kqueue], [])
|
NOTIFY_SUMMARY="yes -lkqueue"
|
||||||
if test "$ac_cv_search_kqueue" != no; then
|
else
|
||||||
AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
|
AC_SEARCH_LIBS([kqueue], [])
|
||||||
NOTIFY_OBJ=kqueue.o
|
if test "$ac_cv_search_kqueue" != no; then
|
||||||
NOTIFY_SUMMARY="yes (kqueue)"
|
AC_DEFINE([HAVE_KQUEUE], [1], [Define to 1 to use kqueue.])
|
||||||
fi
|
NOTIFY_OBJ=kqueue.o
|
||||||
fi ;;
|
NOTIFY_SUMMARY="yes (kqueue)"
|
||||||
esac
|
fi
|
||||||
|
fi ;;
|
||||||
|
esac])
|
||||||
|
|
||||||
dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED
|
dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED
|
||||||
dnl has been added in glib 2.24. It has been tested under
|
dnl has been added in glib 2.24. It has been tested under
|
||||||
|
|
37
src/kqueue.c
37
src/kqueue.c
|
@ -444,23 +444,29 @@ only when the upper directory of the renamed file is watched. */)
|
||||||
if (! NILP (Fmember (Qrevoke, flags))) fflags |= NOTE_REVOKE;
|
if (! NILP (Fmember (Qrevoke, flags))) fflags |= NOTE_REVOKE;
|
||||||
|
|
||||||
/* Register event. */
|
/* Register event. */
|
||||||
EV_SET (&kev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
|
EV_SET (&kev, fd, EVFILT_VNODE, (EV_ADD
|
||||||
|
#ifdef EV_ENABLE
|
||||||
|
| EV_ENABLE
|
||||||
|
#endif /* EV_ENABLE */
|
||||||
|
| EV_CLEAR),
|
||||||
fflags, 0, NULL);
|
fflags, 0, NULL);
|
||||||
|
|
||||||
if (kevent (kqueuefd, &kev, 1, NULL, 0, NULL) < 0) {
|
if (kevent (kqueuefd, &kev, 1, NULL, 0, NULL) < 0)
|
||||||
emacs_close (fd);
|
{
|
||||||
report_file_error ("Cannot watch file", file);
|
emacs_close (fd);
|
||||||
}
|
report_file_error ("Cannot watch file", file);
|
||||||
|
}
|
||||||
|
|
||||||
/* Store watch object in watch list. */
|
/* Store watch object in watch list. */
|
||||||
Lisp_Object watch_descriptor = make_fixnum (fd);
|
Lisp_Object watch_descriptor = make_fixnum (fd);
|
||||||
if (NILP (Ffile_directory_p (file)))
|
if (NILP (Ffile_directory_p (file)))
|
||||||
watch_object = list4 (watch_descriptor, file, flags, callback);
|
watch_object = list4 (watch_descriptor, file, flags, callback);
|
||||||
else {
|
else
|
||||||
dir_list = directory_files_internal (file, Qnil, Qnil, Qnil, true, Qnil,
|
{
|
||||||
Qnil);
|
dir_list = directory_files_internal (file, Qnil, Qnil, Qnil, true, Qnil,
|
||||||
watch_object = list5 (watch_descriptor, file, flags, callback, dir_list);
|
Qnil);
|
||||||
}
|
watch_object = list5 (watch_descriptor, file, flags, callback, dir_list);
|
||||||
|
}
|
||||||
watch_list = Fcons (watch_object, watch_list);
|
watch_list = Fcons (watch_object, watch_list);
|
||||||
|
|
||||||
return watch_descriptor;
|
return watch_descriptor;
|
||||||
|
@ -486,11 +492,12 @@ WATCH-DESCRIPTOR should be an object returned by `kqueue-add-watch'. */)
|
||||||
/* Remove watch descriptor from watch list. */
|
/* Remove watch descriptor from watch list. */
|
||||||
watch_list = Fdelq (watch_object, watch_list);
|
watch_list = Fdelq (watch_object, watch_list);
|
||||||
|
|
||||||
if (NILP (watch_list) && (kqueuefd >= 0)) {
|
if (NILP (watch_list) && (kqueuefd >= 0))
|
||||||
delete_read_fd (kqueuefd);
|
{
|
||||||
emacs_close (kqueuefd);
|
delete_read_fd (kqueuefd);
|
||||||
kqueuefd = -1;
|
emacs_close (kqueuefd);
|
||||||
}
|
kqueuefd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return Qt;
|
return Qt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue