]> git.sesse.net Git - vlc/commitdiff
Linux: re-implement eventfd() against old glibc versions
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 31 Jan 2009 16:47:44 +0000 (18:47 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 31 Jan 2009 16:49:10 +0000 (18:49 +0200)
configure.ac
src/misc/objects.c

index 33402285f90754c8a86c5359b92a70ed95f421bb..ae316156fd7c1b52b07fbe50875c314ac3efcde7 100644 (file)
@@ -514,7 +514,7 @@ AC_FUNC_ALLOCA
 AC_CHECK_FUNCS(fcntl)
 
 dnl Check for Linux system calls
-AC_CHECK_FUNCS([vmsplice eventfd])
+AC_CHECK_FUNCS([vmsplice])
 
 AH_BOTTOM([#include <vlc_fixups.h>])
 
index 748eaeb413bd598adad231a642c1963c65566810..2fe32064ed7281e3d24c30ac3d6fee5fc3986202 100644 (file)
 # include <fcntl.h>
 # include <errno.h> /* ENOSYS */
 #endif
-#ifdef HAVE_SYS_EVENTFD_H
-# include <sys/eventfd.h>
-#endif
+
 #include <assert.h>
 
+#ifdef __linux__
+# if defined (HAVE_SYS_EVENTFD_H)
+#  include <sys/eventfd.h>
+# else
+#  include <sys/syscall.h>
+static inline int eventfd (unsigned int initval, int flags)
+{
+    return syscall (SYS_eventfd, initval, flags);
+}
+# endif
+# define HAVE_EVENTFD 1
+#endif
+
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -392,7 +404,7 @@ int vlc_object_waitpipe( vlc_object_t *obj )
         /* This can only ever happen if someone killed us without locking: */
         assert (internals->pipes[1] == -1);
 
-#ifdef HAVE_SYS_EVENTFD_H
+#ifdef HAVE_EVENTFD
         internals->pipes[0] = internals->pipes[1] = eventfd (0, 0);
         if (internals->pipes[0] == -1)
 #endif