diff --git a/configure.ac b/configure.ac index 403c20fd46..6dcb82a732 100644 --- a/configure.ac +++ b/configure.ac @@ -468,12 +468,16 @@ netinet/in.h \ siginfo.h \ stdint.h \ strings.h \ +sys/inotify.h \ sys/types.h \ sys/param.h \ sys/mman.h \ unistd.h \ ]) +have_inotify="${ac_cv_header_sys_inotify_h}" +AM_CONDITIONAL([HAVE_INOTIFY], [test "x${have_inotify}" = "xyes"]) + EFL_CHECK_PATH_MAX @@ -2368,17 +2372,6 @@ AC_ARG_ENABLE([poll], ], [want_poll="yes"]) -AC_ARG_ENABLE([inotify], - [AC_HELP_STRING([--disable-inotify], - [disable inotify in the ecore_file module. @<:@default=enabled@:>@])], - [ - if test "x${enableval}" = "xyes" ; then - want_inotify="yes" - else - want_inotify="no" - fi - ], - [want_inotify="yes"]) AC_ARG_ENABLE([atfile-source], [AC_HELP_STRING([--disable-atfile-source], @@ -2440,19 +2433,6 @@ requirements_pc_ecore_file="ecore-con >= ${PACKAGE_VERSION} ecore >= ${PACKAGE_V ### Checks for header files -have_inotify="no" -if test "x${want_inotify}" = "xyes" ; then - AC_CHECK_HEADER([sys/inotify.h], - [ - AC_DEFINE([HAVE_INOTIFY], [1], [File monitoring with Inotify]) - have_inotify="yes" - ], - [have_inotify="no"]) -fi - -AC_MSG_CHECKING([whether inotify is to be used for filemonitoring]) -AC_MSG_RESULT(${have_inotify}) - ### Checks for types ### Checks for structures @@ -3954,12 +3934,8 @@ setxattr("/", "user.ethumb.md5", NULL, 0, 0); AC_MSG_RESULT([${have_xattr}]) # Check for inotify specificity -have_inotify="no" have_notify_win32="no" -EIO_CHECK_INOTIFY([have_inotify="yes"], [have_inotify="no"]) EIO_CHECK_NOTIFY_WIN32([have_notify_win32="yes"], [have_notify_win32="no"]) - -AM_CONDITIONAL([EIO_HAVE_INOTIFY], [test "x${have_inotify}" = "xyes"]) AM_CONDITIONAL([EIO_HAVE_WINCHANGE], [test "x${have_notify_win32}" = "xyes"]) #### End of Eio diff --git a/m4/eio_check_options.m4 b/m4/eio_check_options.m4 index 485dd85595..5fb901273c 100644 --- a/m4/eio_check_options.m4 +++ b/m4/eio_check_options.m4 @@ -1,47 +1,3 @@ -dnl use: EIO_CHECK_INOTIFY([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -AC_DEFUN([EIO_CHECK_INOTIFY], -[ -_eio_have_inotify="no" - -dnl We need to check if the right inotify version is accessible - -dnl It is hard to find a good test on how to check the correct -dnl inotify version. They changed the headers a lot. -dnl in kernel 2.6.13 __NR_inotify_init was added to the defined syscalls -dnl in asm/unistd.h and IN_MOVE_SELF was added to linux/inotify.h -dnl so with this check you need a very new kernel and kernel-headers! - -if ! test "x${have_windows}" = "xyes" ; then - - AC_CHECK_LIB([c], [inotify_init], - [ - AC_DEFINE([HAVE_INOTIFY], [1], [ File monitoring with Inotify ]) - AC_DEFINE([HAVE_SYS_INOTIFY], [1], [ File monitoring with Inotify - sys/inotify.h ]) - _eio_have_inotify="yes" - ], - [ - AC_TRY_COMPILE( - [ -#include -#include - ], - [ -int a = __NR_inotify_init; int b = IN_MOVE_SELF; - ], - [ - AC_DEFINE([HAVE_INOTIFY], [1], [ File monitoring with Inotify ]) - _eio_have_inotify="yes" - ], - [_eio_have_inotify="no"]) - ]) -fi - -AC_MSG_CHECKING([whether inotify is to be used for filemonitoring]) -AC_MSG_RESULT([${_eio_have_inotify}]) - -AS_IF([test "x${_eio_have_inotify}" = "xyes"], [$1], [$2]) -]) - dnl use: EIO_CHECK_NOTIFY_WIN32([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) AC_DEFUN([EIO_CHECK_NOTIFY_WIN32], [ diff --git a/src/Makefile_Eio.am b/src/Makefile_Eio.am index 28286b455b..9624285e13 100644 --- a/src/Makefile_Eio.am +++ b/src/Makefile_Eio.am @@ -18,7 +18,7 @@ lib/eio/eio_single.c \ lib/eio/eio_xattr.c \ lib/eio/eio_private.h -if EIO_HAVE_INOTIFY +if HAVE_INOTIFY lib_eio_libeio_la_SOURCES += lib/eio/eio_monitor_inotify.c else if EIO_HAVE_WINCHANGE diff --git a/src/lib/ecore_file/ecore_file_monitor.c b/src/lib/ecore_file/ecore_file_monitor.c index 8b07589a9e..ac7d6d4dc3 100644 --- a/src/lib/ecore_file/ecore_file_monitor.c +++ b/src/lib/ecore_file/ecore_file_monitor.c @@ -6,7 +6,7 @@ typedef enum { ECORE_FILE_MONITOR_TYPE_NONE, -#ifdef HAVE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H ECORE_FILE_MONITOR_TYPE_INOTIFY, #endif #ifdef HAVE_NOTIFY_WIN32 @@ -22,7 +22,7 @@ static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; int ecore_file_monitor_init(void) { -#ifdef HAVE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY; if (ecore_file_monitor_inotify_init()) return 1; @@ -48,7 +48,7 @@ ecore_file_monitor_shutdown(void) { case ECORE_FILE_MONITOR_TYPE_NONE: break; -#ifdef HAVE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H case ECORE_FILE_MONITOR_TYPE_INOTIFY: ecore_file_monitor_inotify_shutdown(); break; @@ -101,7 +101,7 @@ ecore_file_monitor_add(const char *path, { case ECORE_FILE_MONITOR_TYPE_NONE: return NULL; -#ifdef HAVE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H case ECORE_FILE_MONITOR_TYPE_INOTIFY: return ecore_file_monitor_inotify_add(path, func, data); #endif @@ -138,7 +138,7 @@ ecore_file_monitor_del(Ecore_File_Monitor *em) { case ECORE_FILE_MONITOR_TYPE_NONE: break; -#ifdef HAVE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H case ECORE_FILE_MONITOR_TYPE_INOTIFY: ecore_file_monitor_inotify_del(em); break; diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c index 1b682fc4a0..9cb5de83e6 100644 --- a/src/lib/ecore_file/ecore_file_monitor_inotify.c +++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c @@ -20,7 +20,7 @@ * - Listen to IN_IGNORED, emitted when the watch is removed */ -#ifdef HAVE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H #include @@ -328,4 +328,4 @@ _ecore_file_monitor_inotify_print(char *file, int mask) INF("Inotify unmount %s: %s", type, file); } #endif -#endif /* HAVE_INOTIFY */ +#endif /* HAVE_SYS_INOTIFY_H */ diff --git a/src/lib/ecore_file/ecore_file_private.h b/src/lib/ecore_file/ecore_file_private.h index 45d2cbd65c..769f2ba014 100644 --- a/src/lib/ecore_file/ecore_file_private.h +++ b/src/lib/ecore_file/ecore_file_private.h @@ -81,7 +81,7 @@ struct _Ecore_File_Monitor Ecore_File *files; }; -#ifdef HAVE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H int ecore_file_monitor_inotify_init(void); int ecore_file_monitor_inotify_shutdown(void); Ecore_File_Monitor *ecore_file_monitor_inotify_add(const char *path, diff --git a/src/lib/eio/eio_monitor_inotify.c b/src/lib/eio/eio_monitor_inotify.c index 66abe9c1df..7650688347 100644 --- a/src/lib/eio/eio_monitor_inotify.c +++ b/src/lib/eio/eio_monitor_inotify.c @@ -20,11 +20,8 @@ #include "eio_private.h" #include "Eio.h" -#ifdef HAVE_SYS_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H # include -#else -# include -# include #endif /*============================================================================* @@ -70,26 +67,6 @@ static const Eio_Inotify_Table match[] = { EIO_INOTIFY_LINE(IN_UNMOUNT, SELF_DELETED, SELF_DELETED) }; -#ifndef HAVE_SYS_INOTIFY -static inline int -inotify_init(void) -{ - return syscall(__NR_inotify_init); -} - -static inline int -inotify_add_watch(int fd, const char *name, __u32 mask) -{ - return syscall(__NR_inotify_add_watch, fd, name, mask); -} - -static inline int -inotify_rm_watch(int fd, __u32 wd) -{ - return syscall(__NR_inotify_rm_watch, fd, wd); -} -#endif - static void _eio_inotify_del(void *data) { diff --git a/src/lib/eio/eio_monitor_poll.c b/src/lib/eio/eio_monitor_poll.c index 4cd7d1ad78..2b9eb7cd8e 100644 --- a/src/lib/eio/eio_monitor_poll.c +++ b/src/lib/eio/eio_monitor_poll.c @@ -270,7 +270,7 @@ _eio_monitor_fallback_timer_cb(void *data) * @cond LOCAL */ -#if !defined HAVE_INOTIFY && !defined HAVE_NOTIFY_WIN32 +#if !defined HAVE_SYS_INOTIFY_H && !defined HAVE_NOTIFY_WIN32 void eio_monitor_backend_init(void) { }