diff --git a/configure b/configure index 451c92d2b4d..158d9833292 100755 --- a/configure +++ b/configure @@ -690,6 +690,8 @@ HAL_LIBS HAL_CFLAGS DBUS_LIBS DBUS_CFLAGS +INOTIFY_LIBS +INOTIFY_CFLAGS XSLT_LIBS XSLT_CFLAGS XML2_LIBS @@ -851,6 +853,7 @@ with_gsm with_gssapi with_gstreamer with_hal +with_inotify with_jpeg with_krb5 with_ldap @@ -1813,6 +1816,8 @@ XML2_CFLAGS XML2_LIBS XSLT_CFLAGS XSLT_LIBS +INOTIFY_CFLAGS +INOTIFY_LIBS DBUS_CFLAGS DBUS_LIBS HAL_CFLAGS @@ -2522,6 +2527,7 @@ Optional Packages: --without-gssapi do not use GSSAPI (Kerberos SSP support) --without-gstreamer do not use GStreamer (codecs support) --without-hal do not use HAL (dynamic device support) + --without-inotify do not use inotify (filesystem change notifications) --without-jpeg do not use JPEG --without-krb5 do not use krb5 (Kerberos) --without-ldap do not use LDAP @@ -2581,6 +2587,10 @@ Some influential environment variables: XML2_LIBS Linker flags for libxml-2.0, overriding pkg-config XSLT_CFLAGS C compiler flags for libxslt, overriding pkg-config XSLT_LIBS Linker flags for libxslt, overriding pkg-config + INOTIFY_CFLAGS + C compiler flags for libinotify, overriding pkg-config + INOTIFY_LIBS + Linker flags for libinotify, overriding pkg-config DBUS_CFLAGS C compiler flags for dbus-1, overriding pkg-config DBUS_LIBS Linker flags for dbus-1, overriding pkg-config HAL_CFLAGS C compiler flags for hal, overriding pkg-config @@ -3931,6 +3941,12 @@ if test "${with_hal+set}" = set; then : fi +# Check whether --with-inotify was given. +if test "${with_inotify+set}" = set; then : + withval=$with_inotify; +fi + + # Check whether --with-jpeg was given. if test "${with_jpeg+set}" = set; then : withval=$with_jpeg; @@ -7401,7 +7417,6 @@ for ac_header in \ sys/event.h \ sys/exec_elf.h \ sys/filio.h \ - sys/inotify.h \ sys/ioctl.h \ sys/ipc.h \ sys/limits.h \ @@ -13009,6 +13024,94 @@ esac fi +if test "x$with_inotify" != "xno" +then + if ${INOTIFY_CFLAGS:+false} :; then : + if ${PKG_CONFIG+:} false; then : + INOTIFY_CFLAGS=`$PKG_CONFIG --cflags libinotify 2>/dev/null` +fi +fi + +if ${INOTIFY_LIBS:+false} :; then : + if ${PKG_CONFIG+:} false; then : + INOTIFY_LIBS=`$PKG_CONFIG --libs libinotify 2>/dev/null` +fi +fi + + +$as_echo "$as_me:${as_lineno-$LINENO}: libinotify cflags: $INOTIFY_CFLAGS" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: libinotify libs: $INOTIFY_LIBS" >&5 +ac_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $INOTIFY_CFLAGS" +for ac_header in sys/inotify.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_inotify_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_INOTIFY_H 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inotify_add_watch in -linotify" >&5 +$as_echo_n "checking for inotify_add_watch in -linotify... " >&6; } +if ${ac_cv_lib_inotify_inotify_add_watch+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linotify $INOTIFY_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inotify_add_watch (); +int +main () +{ +return inotify_add_watch (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_inotify_inotify_add_watch=yes +else + ac_cv_lib_inotify_inotify_add_watch=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inotify_inotify_add_watch" >&5 +$as_echo "$ac_cv_lib_inotify_inotify_add_watch" >&6; } +if test "x$ac_cv_lib_inotify_inotify_add_watch" = xyes; then : + : +else + INOTIFY_LIBS="" +fi + +CPPFLAGS=$ac_save_CPPFLAGS +test -z "$INOTIFY_CFLAGS" || INOTIFY_CFLAGS=`echo " $INOTIFY_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'` +test -z "$INOTIFY_LIBS" || INOTIFY_LIBS=`echo " $INOTIFY_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'` + +fi +if test "$ac_cv_header_sys_inotify_h" != "yes"; then : + case "x$with_inotify" in + x) as_fn_append wine_notices "|libinotify ${notice_platform}development files not found (or too old), filesystem change notifications won't be supported." ;; + xno) ;; + *) as_fn_error $? "libinotify ${notice_platform}development files not found (or too old), filesystem change notifications won't be supported. +This is an error since --with-inotify was requested." "$LINENO" 5 ;; +esac + +fi + if test "x$with_dbus" != "xno" then if ${DBUS_CFLAGS:+false} :; then : @@ -19683,6 +19786,8 @@ XML2_CFLAGS = $XML2_CFLAGS XML2_LIBS = $XML2_LIBS XSLT_CFLAGS = $XSLT_CFLAGS XSLT_LIBS = $XSLT_LIBS +INOTIFY_CFLAGS = $INOTIFY_CFLAGS +INOTIFY_LIBS = $INOTIFY_LIBS DBUS_CFLAGS = $DBUS_CFLAGS DBUS_LIBS = $DBUS_LIBS HAL_CFLAGS = $HAL_CFLAGS diff --git a/configure.ac b/configure.ac index 611dc69c2e3..c2f97e0f7db 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,7 @@ AC_ARG_WITH(gsm, AS_HELP_STRING([--without-gsm],[do not use libgsm (GSM 06 AC_ARG_WITH(gssapi, AS_HELP_STRING([--without-gssapi],[do not use GSSAPI (Kerberos SSP support)])) AC_ARG_WITH(gstreamer, AS_HELP_STRING([--without-gstreamer],[do not use GStreamer (codecs support)])) AC_ARG_WITH(hal, AS_HELP_STRING([--without-hal],[do not use HAL (dynamic device support)])) +AC_ARG_WITH(inotify, AS_HELP_STRING([--without-inotify],[do not use inotify (filesystem change notifications)])) AC_ARG_WITH(jpeg, AS_HELP_STRING([--without-jpeg],[do not use JPEG])) AC_ARG_WITH(krb5, AS_HELP_STRING([--without-krb5],[do not use krb5 (Kerberos)])) AC_ARG_WITH(ldap, AS_HELP_STRING([--without-ldap],[do not use LDAP]), @@ -491,7 +492,6 @@ AC_CHECK_HEADERS(\ sys/event.h \ sys/exec_elf.h \ sys/filio.h \ - sys/inotify.h \ sys/ioctl.h \ sys/ipc.h \ sys/limits.h \ @@ -1347,6 +1347,16 @@ fi WINE_WARNING_WITH(xslt,[test "x$ac_cv_lib_soname_xslt" = "x"], [libxslt ${notice_platform}development files not found, xslt won't be supported.]) +dnl **** Check for inotify **** +if test "x$with_inotify" != "xno" +then + WINE_PACKAGE_FLAGS(INOTIFY,[libinotify],,,, + [AC_CHECK_HEADERS([sys/inotify.h]) + AC_CHECK_LIB(inotify,inotify_add_watch,[:],[INOTIFY_LIBS=""],[$INOTIFY_LIBS])]) +fi +WINE_NOTICE_WITH(inotify,[test "$ac_cv_header_sys_inotify_h" != "yes"], + [libinotify ${notice_platform}development files not found (or too old), filesystem change notifications won't be supported.]) + dnl **** Check for libdbus **** if test "x$with_dbus" != "xno" then diff --git a/server/Makefile.in b/server/Makefile.in index 29f17f31578..b39bd30305b 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -50,4 +50,4 @@ MANPAGES = \ wineserver.fr.UTF-8.man.in \ wineserver.man.in -EXTRALIBS = $(LDEXECFLAGS) -lwine $(POLL_LIBS) $(RT_LIBS) +EXTRALIBS = $(LDEXECFLAGS) -lwine $(POLL_LIBS) $(RT_LIBS) $(INOTIFY_LIBS) diff --git a/server/change.c b/server/change.c index eb27dae5988..6091d21f7f2 100644 --- a/server/change.c +++ b/server/change.c @@ -35,6 +35,9 @@ #ifdef HAVE_POLL_H # include #endif +#ifdef HAVE_SYS_INOTIFY_H +#include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -65,56 +68,6 @@ /* inotify support */ -#ifdef HAVE_SYS_INOTIFY_H -#include -#define USE_INOTIFY -#elif defined(__linux__) && defined(__i386__) - -#define SYS_inotify_init 291 -#define SYS_inotify_add_watch 292 -#define SYS_inotify_rm_watch 293 - -struct inotify_event { - int wd; - unsigned int mask; - unsigned int cookie; - unsigned int len; - char name[1]; -}; - -#define IN_ACCESS 0x00000001 -#define IN_MODIFY 0x00000002 -#define IN_ATTRIB 0x00000004 -#define IN_CLOSE_WRITE 0x00000008 -#define IN_CLOSE_NOWRITE 0x00000010 -#define IN_OPEN 0x00000020 -#define IN_MOVED_FROM 0x00000040 -#define IN_MOVED_TO 0x00000080 -#define IN_CREATE 0x00000100 -#define IN_DELETE 0x00000200 -#define IN_DELETE_SELF 0x00000400 - -#define IN_ISDIR 0x40000000 - -static inline int inotify_init( void ) -{ - return syscall( SYS_inotify_init ); -} - -static inline int inotify_add_watch( int fd, const char *name, unsigned int mask ) -{ - return syscall( SYS_inotify_add_watch, fd, name, mask ); -} - -static inline int inotify_rm_watch( int fd, int wd ) -{ - return syscall( SYS_inotify_rm_watch, fd, wd ); -} - -#define USE_INOTIFY - -#endif - struct inode; static void free_inode( struct inode *inode ); @@ -521,7 +474,7 @@ static enum server_fd_type dir_get_fd_type( struct fd *fd ) return FD_TYPE_DIR; } -#ifdef USE_INOTIFY +#ifdef HAVE_SYS_INOTIFY_H #define HASH_SIZE 31 @@ -1175,7 +1128,7 @@ static int dir_add_to_existing_notify( struct dir *dir ) return 0; } -#endif /* USE_INOTIFY */ +#endif /* HAVE_SYS_INOTIFY_H */ struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode ) {