about summary refs log tree commit diff
path: root/src/linux/eventfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/linux/eventfd.c')
-rw-r--r--src/linux/eventfd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/linux/eventfd.c b/src/linux/eventfd.c
index cb39a7ba..53066487 100644
--- a/src/linux/eventfd.c
+++ b/src/linux/eventfd.c
@@ -1,7 +1,18 @@
 #include <sys/eventfd.h>
+#include <unistd.h>
 #include "syscall.h"
 
 int eventfd(unsigned int count, int flags)
 {
 	return syscall(flags ? SYS_eventfd2 : SYS_eventfd, count, flags);
 }
+
+int eventfd_read(int fd, eventfd_t *value)
+{
+	return (sizeof(*value) == read(fd, value, sizeof(*value))) ? 0 : -1;
+}
+
+int eventfd_write(int fd, eventfd_t value)
+{
+	return (sizeof(value) == write(fd, &value, sizeof(value))) ? 0 : -1;
+}