linux: remove inotify support on glibc < 2.4

Günther Brammer 2011-03-17 02:33:56 +01:00
parent cacceef1c6
commit fe1ea5c5a3
5 changed files with 3 additions and 99 deletions

View File

@ -85,9 +85,6 @@
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* inotify reachable using syscall */
#cmakedefine HAVE_SYSCALL_INOTIFY 1
/* Define to 1 if you have the <sys/inotify.h> header file. */
#cmakedefine HAVE_SYS_INOTIFY_H 1
@ -103,9 +100,6 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/syscall.h> header file. */
#cmakedefine HAVE_SYS_SYSCALL_H 1
/* Define to 1 if you have the <sys/timerfd.h> header file. */
#cmakedefine HAVE_SYS_TIMERFD_H 1

View File

@ -87,9 +87,6 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* inotify reachable using syscall */
#undef HAVE_SYSCALL_INOTIFY
/* Define to 1 if you have the <sys/eventfd.h> header file. */
#undef HAVE_SYS_EVENTFD_H
@ -105,9 +102,6 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/timerfd.h> header file. */
#undef HAVE_SYS_TIMERFD_H

View File

@ -56,7 +56,7 @@ AM_CONDITIONAL(MACOSX, [test $osx = true])
# various used headers
dnl the whitespace is there to prevent AC_INCLUDES_DEFAULT
AC_CHECK_HEADERS([stdint.h unistd.h poll.h sys/file.h sys/stat.h sys/types.h locale.h sys/socket.h signal.h langinfo.h sys/eventfd.h sys/timerfd.h sys/inotify.h sys/syscall.h], , , [[ ]])
AC_CHECK_HEADERS([stdint.h unistd.h poll.h sys/file.h sys/stat.h sys/types.h locale.h sys/socket.h signal.h langinfo.h sys/eventfd.h sys/timerfd.h sys/inotify.h], , , [[ ]])
# Mingw does not ship with multimon.h
AC_CHECK_HEADERS([multimon.h io.h direct.h share.h], [], [], [[#include <windows.h>]])
# iconv
@ -314,11 +314,6 @@ if test $win32 = false; then
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
# inotify syscall workaround
AC_CHECK_DECL(SYS_inotify_init,
AC_DEFINE([HAVE_SYSCALL_INOTIFY], 1, [inotify reachable using syscall]),,
[#include <sys/syscall.h>])
# FMod is used for windows only
AM_CONDITIONAL(USE_FMOD, false)
else

View File

@ -28,85 +28,6 @@
#ifdef HAVE_SYS_INOTIFY_H
#include <sys/inotify.h>
#elif defined(HAVE_SYSCALL_INOTIFY)
#define _BSD_SOURCE /* or _GNU_SOURCE or _SVID_SOURCE */
#include <unistd.h>
#include <sys/syscall.h> /* For SYS_xxx definitions */
/* Structure describing an inotify event. */
struct inotify_event
{
int wd; /* Watch descriptor. */
uint32_t mask; /* Watch mask. */
uint32_t cookie; /* Cookie to synchronize two events. */
uint32_t len; /* Length (including NULs) of name. */
char name __flexarr; /* Name. */
};
/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */
#define IN_ACCESS 0x00000001 /* File was accessed. */
#define IN_MODIFY 0x00000002 /* File was modified. */
#define IN_ATTRIB 0x00000004 /* Metadata changed. */
#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */
#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */
#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
#define IN_OPEN 0x00000020 /* File was opened. */
#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */
#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */
#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
#define IN_CREATE 0x00000100 /* Subfile was created. */
#define IN_DELETE 0x00000200 /* Subfile was deleted. */
#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */
#define IN_MOVE_SELF 0x00000800 /* Self was moved. */
/* Events sent by the kernel. */
#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */
#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */
#define IN_IGNORED 0x00008000 /* File was ignored. */
/* Helper events. */
#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */
#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */
/* Special flags. */
#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a
directory. */
#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */
#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already
existing watch. */
#define IN_ISDIR 0x40000000 /* Event occurred against dir. */
#define IN_ONESHOT 0x80000000 /* Only send event once. */
/* All events which a program can wait on. */
#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \
| IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \
| IN_MOVED_TO | IN_CREATE | IN_DELETE \
| IN_DELETE_SELF | IN_MOVE_SELF)
/* Create and initialize inotify instance. */
int inotify_init (void) { return syscall(__NR_inotify_init); }
/* Add watch of object NAME to inotify instance FD. Notify about
events specified by MASK. */
int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
{
return syscall(__NR_inotify_add_watch, __fd, __name, __mask);
}
/* Remove the watch specified by WD from the inotify instance FD. */
int inotify_rm_watch (int __fd, uint32_t __wd)
{
return syscall(__NR_inotify_rm_watch, __fd, __wd);
}
#endif
#if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_SYSCALL_INOTIFY)
#include <errno.h>
C4FileMonitor::C4FileMonitor(ChangeNotify pCallback): fStarted(false), pCallback(pCallback)
@ -324,7 +245,7 @@ void C4FileMonitor::HandleNotify(const char *szDir, const _FILE_NOTIFY_INFORMATI
// Stubs
C4FileMonitor::C4FileMonitor(ChangeNotify pCallback)
{
#if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_SYS_SYSCALL_H)
#ifdef HAVE_SYS_INOTIFY_H
C4FileMonitor::pCallback = pCallback;
#endif
}

View File

@ -64,7 +64,7 @@ private:
bool fStarted;
ChangeNotify pCallback;
#if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_SYS_SYSCALL_H)
#ifdef HAVE_SYS_INOTIFY_H
int fd;
std::map<int, const char *> watch_descriptors;
#elif defined(_WIN32)