aboutsummaryrefslogtreecommitdiff
path: root/src/fd_util.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-09 23:01:04 +0100
committerMax Kellermann <max@duempel.org>2013-01-10 00:10:01 +0100
commit3be57dc4a30f1a4b059fec4bd7e46ae03d3c7107 (patch)
tree88a1164b99c7653eb6de26c314c4cf3778921c8a /src/fd_util.c
parenta93caf3cfe461ab7a19b86f456da576e4720fb7b (diff)
fd_util: support eventfd()
Diffstat (limited to 'src/fd_util.c')
-rw-r--r--src/fd_util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fd_util.c b/src/fd_util.c
index 882b4c7d..ea29d6ea 100644
--- a/src/fd_util.c
+++ b/src/fd_util.c
@@ -49,6 +49,10 @@
#include <sys/inotify.h>
#endif
+#ifdef HAVE_EVENTFD
+#include <sys/eventfd.h>
+#endif
+
#ifndef WIN32
static int
@@ -328,6 +332,16 @@ inotify_init_cloexec(void)
#endif
+#ifdef HAVE_EVENTFD
+
+int
+eventfd_cloexec_nonblock(unsigned initval, int flags)
+{
+ return eventfd(initval, flags | EFD_CLOEXEC | EFD_NONBLOCK);
+}
+
+#endif
+
int
close_socket(int fd)
{