From f25d6ad2aa4c7e4c4884dd469c631fafd207ef8f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 20 Mar 2015 23:48:02 +0900 Subject: forkfd: Fix compilation with older glibc glibc 2.9 is required for pipe2 and version 2.7 for eventfd. Bionic added them to Android version 2.3.1, but I can't find a version macro. uclibc masquerades as glibc version 2.2, so this function won't be thread-safe with uclibc. Change-Id: Iee8cbc07c4434ce9b560ffff13cd3c3b63dd7e83 Reviewed-by: Rafael Roquetto Reviewed-by: Giuseppe D'Angelo --- src/3rdparty/forkfd/forkfd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index 5710608d6d..017ae0741e 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -41,9 +41,13 @@ #include #ifdef __linux__ -# define HAVE_PIPE2 1 -# define HAVE_EVENTFD 1 -# include +# if (defined(__GLIBC__) && (__GLIBC__ << 16) + __GLIBC_MINOR__ >= 0x207) || defined(__BIONIC__) +# include +# define HAVE_EVENTFD 1 +# endif +# if (defined(__GLIBC__) && (__GLIBC__ << 16) + __GLIBC_MINOR__ >= 0x209) || defined(__BIONIC__) +# define HAVE_PIPE2 1 +# endif #endif #if _POSIX_VERSION-0 >= 200809L || _XOPEN_VERSION-0 >= 500 -- cgit v1.2.3