summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes2
-rw-r--r--ev.c29
2 files changed, 29 insertions, 2 deletions
diff --git a/Changes b/Changes
index 96dce7b..5c50a48 100644
--- a/Changes
+++ b/Changes
@@ -6,6 +6,8 @@ Revision history for libev, a high-performance and full-featured event loop.
- support EV_IDLE_ENABLE being disabled in ev++.h
(patch by Didier Spezia).
- point out the unspecified signal mask in the documentation.
+ - changed minimum glibc requirement from glibc 2.9 to 2.7, for
+ signalfd.
3.8 Sun Aug 9 14:30:45 CEST 2009
- incompatible change: do not necessarily reset signal handler
diff --git a/ev.c b/ev.c
index 1161aa3..2403b32 100644
--- a/ev.c
+++ b/ev.c
@@ -304,7 +304,7 @@ extern "C" {
#endif
#ifndef EV_USE_SIGNALFD
-# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9))
+# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
# define EV_USE_SIGNALFD 1
# else
# define EV_USE_SIGNALFD 0
@@ -404,9 +404,34 @@ int eventfd (unsigned int initval, int flags);
#endif
#if EV_USE_SIGNALFD
-# include <sys/signalfd.h>
+/* our minimum requirement is glibc 2.7 which has the stub, but not the header */
+# include <stdint.h>
+# ifndef SFD_NONBLOCK
+# define SFD_NONBLOCK O_NONBLOCK
+# endif
+# ifndef SFD_CLOEXEC
+# ifdef O_CLOEXEC
+# define SFD_CLOEXEC O_CLOEXEC
+# else
+# define SFD_CLOEXEC 02000000
+# endif
+# endif
+# ifdef __cplusplus
+extern "C" {
+# endif
+int signalfd (int fd, const sigset_t *mask, int flags);
+
+struct signalfd_siginfo
+{
+ uint32_t ssi_signo;
+ char pad[128 - sizeof (uint32_t)];
+};
+# ifdef __cplusplus
+}
+# endif
#endif
+
/**/
#if EV_VERIFY >= 3