[vlc-devel] commit: Linux: re-implement eventfd() against old glibc versions ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 31 17:49:29 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 31 18:47:44 2009 +0200| [a7779d5911be0dd2ee29240e68d364e346bb12af] | committer: Rémi Denis-Courmont 

Linux: re-implement eventfd() against old glibc versions

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7779d5911be0dd2ee29240e68d364e346bb12af
---

 configure.ac       |    2 +-
 src/misc/objects.c |   20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3340228..ae31615 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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>])
 
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 748eaeb..2fe3206 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -53,11 +53,23 @@
 # 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




More information about the vlc-devel mailing list