inotify is updated to support only kernel 2.6.13 with an updated

kernel-headers. It should work with some older revisions of inotify with
some hacking, but I don't have different versions to check with.


SVN revision: 16394
This commit is contained in:
sebastid 2005-08-29 15:15:59 +00:00 committed by sebastid
parent 5236734f1d
commit a83d7cb3b3
2 changed files with 14 additions and 45 deletions

View File

@ -865,10 +865,15 @@ AC_ARG_ENABLE(inotify,
]
)
dnl It's 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
dnl so with this check you need a very new kernel and kernel-headers!
if test "x$use_inotify" = "xyes"; then
AC_TRY_COMPILE(
[#include <linux/inotify.h>],
[struct inotify_watch_request request;request.fd = 0; request.mask = 0;],
[#include <asm/unistd.h>],
[int i = __NR_inotify_init;],
[
AC_DEFINE(HAVE_INOTIFY, 1, [ File monitoring with Inotify ])
use_inotify="yes"

View File

@ -13,48 +13,9 @@
#ifdef HAVE_INOTIFY
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <asm/unistd.h>
#include <linux/inotify.h>
/* These should go when it is standard that they are defined in userspace kernel headers */
#if defined(__i386__)
# define __NR_inotify_init 291
# define __NR_inotify_add_watch 292
# define __NR_inotify_rm_watch 293
#elif defined(__x86_64__)
# define __NR_inotify_init 253
# define __NR_inotify_add_watch 254
# define __NR_inotify_rm_watch 255
#elif defined(__alpha__)
# define __NR_inotify_init 444
# define __NR_inotify_add_watch 445
# define __NR_inotify_rm_watch 446
#elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc64__)
# define __NR_inotify_init 275
# define __NR_inotify_add_watch 276
# define __NR_inotify_rm_watch 277
#elif defined(__sparc__)
# define __NR_inotify_init 151
# define __NR_inotify_add_watch 152
# define __NR_inotify_rm_watch 156
#elif defined (__ia64__)
# define __NR_inotify_init 1277
# define __NR_inotify_add_watch 1278
# define __NR_inotify_rm_watch 1279
#elif defined (__s390__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
#else
# warning "Unsupported architecture"
#endif
#ifdef __NR_inotify_init
typedef struct _Ecore_File_Monitor_Inotify Ecore_File_Monitor_Inotify;
#define ECORE_FILE_MONITOR_INOTIFY(x) ((Ecore_File_Monitor_Inotify *)(x))
@ -131,7 +92,6 @@ ecore_file_monitor_inotify_add(const char *path,
Ecore_File_Monitor *em;
int len;
printf("Using inotify!\n");
em = calloc(1, sizeof(Ecore_File_Monitor_Inotify));
if (!em) return NULL;
@ -155,7 +115,7 @@ ecore_file_monitor_inotify_add(const char *path,
mask);
if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0)
{
printf("ioctl error\n");
printf("inotify_add_watch error\n");
ecore_file_monitor_inotify_del(em);
return NULL;
}
@ -277,6 +237,11 @@ _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask)
{
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
}
if (mask & IN_MOVE_SELF)
{
/* We just call delete. The dir is gone... */
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
}
if (mask & IN_UNMOUNT)
{
/* We just call delete. The dir is gone... */
@ -301,5 +266,4 @@ inotify_rm_watch(int fd, __u32 wd)
{
return syscall(__NR_inotify_rm_watch, fd, wd);
}
#endif /* __NR_inotify_init */
#endif /* HAVE_INOTIFY */