summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac60
-rw-r--r--m4/eio_check_options.m444
-rw-r--r--src/Makefile_Eio.am2
-rw-r--r--src/lib/eio/eio_monitor_inotify.c25
4 files changed, 107 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index e0d942f..72b2529 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,8 +104,6 @@ AC_ARG_ENABLE([coverage],
104 104
105#### Default values 105#### Default values
106 106
107want_inotify="no"
108
109requirements_pc_crypto="" 107requirements_pc_crypto=""
110requirements_pc_deps_crypto="" 108requirements_pc_deps_crypto=""
111requirements_libs_crypto="" 109requirements_libs_crypto=""
@@ -279,11 +277,6 @@ case "$host_os" in
279 MODULE_ARCH="$host_os-$host_cpu-v_maj.v_min.v_mic" 277 MODULE_ARCH="$host_os-$host_cpu-v_maj.v_min.v_mic"
280 MODULE_EXT=".dll" 278 MODULE_EXT=".dll"
281 ;; 279 ;;
282 linux*)
283 want_inotify="yes"
284 MODULE_ARCH="$host_os-$host_cpu-v_maj.v_min.v_mic"
285 MODULE_EXT=".so"
286 ;;
287 *) 280 *)
288 MODULE_ARCH="$host_os-$host_cpu-v_maj.v_min.v_mic" 281 MODULE_ARCH="$host_os-$host_cpu-v_maj.v_min.v_mic"
289 MODULE_EXT=".so" 282 MODULE_EXT=".so"
@@ -481,17 +474,6 @@ sys/mman.h \
481unistd.h \ 474unistd.h \
482]) 475])
483 476
484have_inotify="no"
485if test "x${want_inotify}" = "xyes" ; then
486 AC_CHECK_HEADER([sys/inotify.h],
487 [
488 AC_DEFINE([HAVE_INOTIFY], [1], [File monitoring with Inotify])
489 have_inotify="yes"
490 ],
491 [have_inotify="no"])
492fi
493AM_CONDITIONAL([HAVE_INOTIFY], [test "x${have_inotify}" = "xyes"])
494
495EFL_CHECK_PATH_MAX 477EFL_CHECK_PATH_MAX
496 478
497 479
@@ -1843,13 +1825,19 @@ fi
1843 1825
1844# cserve2 only works on Linux so far. 1826# cserve2 only works on Linux so far.
1845 1827
1846if test "x${efl_func_shm_open}" = "xno" -o "x${have_inotify}" = "xno"; then 1828if test "x${efl_func_shm_open}" = "xno" ; then
1847 want_evas_cserve2="no" 1829 want_evas_cserve2="no"
1848fi 1830fi
1849 1831
1850AC_DEFINE_IF([EVAS_CSERVE2], 1832if test "x${want_evas_cserve2}" = "xyes" ; then
1851 [test "x${want_evas_cserve2}" = "xyes"], 1833 AC_CHECK_HEADERS([sys/epoll.h sys/inotify.h sys/signalfd.h],
1852 [1], [Shared cache server.]) 1834 [],
1835 [want_evas_cserve2="no"])
1836fi
1837
1838if test "x${want_evas_cserve2}" = "xyes" ; then
1839 AC_DEFINE([EVAS_CSERVE2], [1], [Shared cache server.])
1840fi
1853AM_CONDITIONAL([EVAS_CSERVE2], [test "x${want_evas_cserve2}" = "xyes"]) 1841AM_CONDITIONAL([EVAS_CSERVE2], [test "x${want_evas_cserve2}" = "xyes"])
1854 1842
1855### Configuration 1843### Configuration
@@ -2398,6 +2386,18 @@ AC_ARG_ENABLE([poll],
2398 ], 2386 ],
2399 [want_poll="yes"]) 2387 [want_poll="yes"])
2400 2388
2389AC_ARG_ENABLE([inotify],
2390 [AC_HELP_STRING([--disable-inotify],
2391 [disable inotify in the ecore_file module. @<:@default=enabled@:>@])],
2392 [
2393 if test "x${enableval}" = "xyes" ; then
2394 want_inotify="yes"
2395 else
2396 want_inotify="no"
2397 fi
2398 ],
2399 [want_inotify="yes"])
2400
2401AC_ARG_ENABLE([atfile-source], 2401AC_ARG_ENABLE([atfile-source],
2402 [AC_HELP_STRING([--disable-atfile-source], 2402 [AC_HELP_STRING([--disable-atfile-source],
2403 [disable use of atfile source functions as openat and mkdirat @<:@default=detect@:>@])], 2403 [disable use of atfile source functions as openat and mkdirat @<:@default=detect@:>@])],
@@ -2458,6 +2458,19 @@ requirements_pc_ecore_file="ecore-con >= ${PACKAGE_VERSION} ecore >= ${PACKAGE_V
2458 2458
2459### Checks for header files 2459### Checks for header files
2460 2460
2461have_inotify="no"
2462if test "x${want_inotify}" = "xyes" ; then
2463 AC_CHECK_HEADER([sys/inotify.h],
2464 [
2465 AC_DEFINE([HAVE_INOTIFY], [1], [File monitoring with Inotify])
2466 have_inotify="yes"
2467 ],
2468 [have_inotify="no"])
2469fi
2470
2471AC_MSG_CHECKING([whether inotify is to be used for filemonitoring])
2472AC_MSG_RESULT(${have_inotify})
2473
2461### Checks for types 2474### Checks for types
2462 2475
2463### Checks for structures 2476### Checks for structures
@@ -3959,9 +3972,12 @@ setxattr("/", "user.ethumb.md5", NULL, 0, 0);
3959AC_MSG_RESULT([${have_xattr}]) 3972AC_MSG_RESULT([${have_xattr}])
3960 3973
3961# Check for inotify specificity 3974# Check for inotify specificity
3975have_inotify="no"
3962have_notify_win32="no" 3976have_notify_win32="no"
3977EIO_CHECK_INOTIFY([have_inotify="yes"], [have_inotify="no"])
3963EIO_CHECK_NOTIFY_WIN32([have_notify_win32="yes"], [have_notify_win32="no"]) 3978EIO_CHECK_NOTIFY_WIN32([have_notify_win32="yes"], [have_notify_win32="no"])
3964 3979
3980AM_CONDITIONAL([EIO_HAVE_INOTIFY], [test "x${have_inotify}" = "xyes"])
3965AM_CONDITIONAL([EIO_HAVE_WINCHANGE], [test "x${have_notify_win32}" = "xyes"]) 3981AM_CONDITIONAL([EIO_HAVE_WINCHANGE], [test "x${have_notify_win32}" = "xyes"])
3966 3982
3967#### End of Eio 3983#### End of Eio
diff --git a/m4/eio_check_options.m4 b/m4/eio_check_options.m4
index 5fb9012..485dd85 100644
--- a/m4/eio_check_options.m4
+++ b/m4/eio_check_options.m4
@@ -1,3 +1,47 @@
1dnl use: EIO_CHECK_INOTIFY([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
2AC_DEFUN([EIO_CHECK_INOTIFY],
3[
4_eio_have_inotify="no"
5
6dnl We need to check if the right inotify version is accessible
7
8dnl It is hard to find a good test on how to check the correct
9dnl inotify version. They changed the headers a lot.
10dnl in kernel 2.6.13 __NR_inotify_init was added to the defined syscalls
11dnl in asm/unistd.h and IN_MOVE_SELF was added to linux/inotify.h
12dnl so with this check you need a very new kernel and kernel-headers!
13
14if ! test "x${have_windows}" = "xyes" ; then
15
16 AC_CHECK_LIB([c], [inotify_init],
17 [
18 AC_DEFINE([HAVE_INOTIFY], [1], [ File monitoring with Inotify ])
19 AC_DEFINE([HAVE_SYS_INOTIFY], [1], [ File monitoring with Inotify - sys/inotify.h ])
20 _eio_have_inotify="yes"
21 ],
22 [
23 AC_TRY_COMPILE(
24 [
25#include <asm/unistd.h>
26#include <linux/inotify.h>
27 ],
28 [
29int a = __NR_inotify_init; int b = IN_MOVE_SELF;
30 ],
31 [
32 AC_DEFINE([HAVE_INOTIFY], [1], [ File monitoring with Inotify ])
33 _eio_have_inotify="yes"
34 ],
35 [_eio_have_inotify="no"])
36 ])
37fi
38
39AC_MSG_CHECKING([whether inotify is to be used for filemonitoring])
40AC_MSG_RESULT([${_eio_have_inotify}])
41
42AS_IF([test "x${_eio_have_inotify}" = "xyes"], [$1], [$2])
43])
44
1dnl use: EIO_CHECK_NOTIFY_WIN32([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 45dnl use: EIO_CHECK_NOTIFY_WIN32([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
2AC_DEFUN([EIO_CHECK_NOTIFY_WIN32], 46AC_DEFUN([EIO_CHECK_NOTIFY_WIN32],
3[ 47[
diff --git a/src/Makefile_Eio.am b/src/Makefile_Eio.am
index 9624285..28286b4 100644
--- a/src/Makefile_Eio.am
+++ b/src/Makefile_Eio.am
@@ -18,7 +18,7 @@ lib/eio/eio_single.c \
18lib/eio/eio_xattr.c \ 18lib/eio/eio_xattr.c \
19lib/eio/eio_private.h 19lib/eio/eio_private.h
20 20
21if HAVE_INOTIFY 21if EIO_HAVE_INOTIFY
22lib_eio_libeio_la_SOURCES += lib/eio/eio_monitor_inotify.c 22lib_eio_libeio_la_SOURCES += lib/eio/eio_monitor_inotify.c
23else 23else
24if EIO_HAVE_WINCHANGE 24if EIO_HAVE_WINCHANGE
diff --git a/src/lib/eio/eio_monitor_inotify.c b/src/lib/eio/eio_monitor_inotify.c
index 76e7c93..66abe9c 100644
--- a/src/lib/eio/eio_monitor_inotify.c
+++ b/src/lib/eio/eio_monitor_inotify.c
@@ -20,8 +20,11 @@
20#include "eio_private.h" 20#include "eio_private.h"
21#include "Eio.h" 21#include "Eio.h"
22 22
23#ifdef HAVE_INOTIFY 23#ifdef HAVE_SYS_INOTIFY
24# include <sys/inotify.h> 24# include <sys/inotify.h>
25#else
26# include <asm/unistd.h>
27# include <linux/inotify.h>
25#endif 28#endif
26 29
27/*============================================================================* 30/*============================================================================*
@@ -67,6 +70,26 @@ static const Eio_Inotify_Table match[] = {
67 EIO_INOTIFY_LINE(IN_UNMOUNT, SELF_DELETED, SELF_DELETED) 70 EIO_INOTIFY_LINE(IN_UNMOUNT, SELF_DELETED, SELF_DELETED)
68}; 71};
69 72
73#ifndef HAVE_SYS_INOTIFY
74static inline int
75inotify_init(void)
76{
77 return syscall(__NR_inotify_init);
78}
79
80static inline int
81inotify_add_watch(int fd, const char *name, __u32 mask)
82{
83 return syscall(__NR_inotify_add_watch, fd, name, mask);
84}
85
86static inline int
87inotify_rm_watch(int fd, __u32 wd)
88{
89 return syscall(__NR_inotify_rm_watch, fd, wd);
90}
91#endif
92
70static void 93static void
71_eio_inotify_del(void *data) 94_eio_inotify_del(void *data)
72{ 95{