[PATCH] wineserver: inotify cleanups and detection improvements

Damjan Jovanovic damjan.jov at gmail.com
Sat Apr 20 08:14:53 CDT 2019


Outside Linux, wineserver fails to link when sys/inotify.h
is present, as it tries to find inotify symbols in libc,
which doesn't have them. The inotify symbols are in libinotify.so.
Detect it properly, and link to it where available.

Also clean up usage of inotify on Linux/i386. It shouldn't need to
redefine everything, the header was available in sys/inotify.h
for a long time now.

Does not regenerate "configure".

Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 configure.ac       | 11 ++++++++++-
 server/Makefile.in |  2 +-
 server/change.c    | 45 ---------------------------------------------
 3 files changed, 11 insertions(+), 47 deletions(-)
-------------- next part --------------
diff --git a/configure.ac b/configure.ac
index 611dc69c2e..46c3970e65 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,15 @@ 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_HEADER([sys/inotify.h])])
+fi
+WINE_WARNING_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 29f17f3157..b39bd30305 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 eb27dae598..f80a5cd9dd 100644
--- a/server/change.c
+++ b/server/change.c
@@ -68,51 +68,6 @@
 #ifdef HAVE_SYS_INOTIFY_H
 #include <sys/inotify.h>
 #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;


More information about the wine-devel mailing list