Fix for systems which do not have inotify support in glibc.

SVN revision: 29340
This commit is contained in:
Sebastian Dransfeld 2007-04-04 11:10:44 +00:00
parent 943b05a5d9
commit bddb9be5cf
2 changed files with 29 additions and 2 deletions

View File

@ -511,7 +511,7 @@ if test "x$have_ecore_file" = "xyes"; then
#include <asm/unistd.h>
#include <linux/inotify.h>
],
[ int a = IN_MOVE_SELF; void *f = inotify_init(); ],
[ int a = __NR_inotify_init; int b = IN_IGNORED; ],
[
AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
], [

View File

@ -14,13 +14,20 @@
#ifdef HAVE_INOTIFY
# ifdef HAVE_SYS_INOTIFY
#ifdef HAVE_SYS_INOTIFY
# include <sys/inotify.h>
#else
# include <asm/unistd.h>
# include <linux/inotify.h>
#endif
#ifndef HAVE_SYS_INOTIFY
static inline int inotify_init(void);
static inline int inotify_add_watch(int fd, const char *name, __u32 mask);
static inline int inotify_rm_watch(int fd, __u32 wd);
#endif
typedef struct _Ecore_File_Monitor_Inotify Ecore_File_Monitor_Inotify;
#define ECORE_FILE_MONITOR_INOTIFY(x) ((Ecore_File_Monitor_Inotify *)(x))
@ -281,6 +288,26 @@ _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path)
return 1;
}
#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
#if 0
static void
_ecore_file_monitor_inotify_print(char *file, int mask)