[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torsocks/master] Support the eventfd2(2) syscall.
commit d6d79e31abe97b55ea944e13e134813aabe1bc86
Author: Yawning Angel <yawning@xxxxxxxxxxxxxxx>
Date: Tue Apr 7 11:28:53 2015 +0000
Support the eventfd2(2) syscall.
Signed-off-by: Yawning Angel <yawning@xxxxxxxxxxxxxxx>
---
src/common/compat.h | 5 +++++
src/lib/syscall.c | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/src/common/compat.h b/src/common/compat.h
index 8c3be78..187818c 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -118,6 +118,7 @@ void tsocks_mutex_unlock(tsocks_mutex_t *m);
*/
#include <sys/epoll.h>
+#include <sys/eventfd.h>
#ifndef __NR_epoll_create1
#define __NR_epoll_create1 -128
@@ -131,11 +132,15 @@ void tsocks_mutex_unlock(tsocks_mutex_t *m);
#ifndef __NR_epoll_ctl
#define __NR_epoll_ctl -131
#endif
+#ifndef __NR_eventfd2
+#define __NR_eventfd2 -132
+#endif
#define TSOCKS_NR_EPOLL_CREATE1 __NR_epoll_create1
#define TSOCKS_NR_EPOLL_WAIT __NR_epoll_wait
#define TSOCKS_NR_EPOLL_PWAIT __NR_epoll_pwait
#define TSOCKS_NR_EPOLL_CTL __NR_epoll_ctl
+#define TSOCKS_NR_EVENTFD2 __NR_eventfd2
#endif /* __linux__ */
diff --git a/src/lib/syscall.c b/src/lib/syscall.c
index c6585a8..55e2447 100644
--- a/src/lib/syscall.c
+++ b/src/lib/syscall.c
@@ -298,6 +298,20 @@ static LIBC_SYSCALL_RET_TYPE handle_epoll_ctl(va_list args)
return epoll_ctl(epfd, op, fd, event);
}
+
+/*
+ * Handle eventfd2(2) syscall.
+ */
+static LIBC_SYSCALL_RET_TYPE handle_eventfd2(va_list args)
+{
+ unsigned int initval;
+ int flags;
+
+ initval = va_arg(args, __typeof__(initval));
+ flags = va_arg(args, __typeof__(flags));
+
+ return eventfd(initval, flags);
+}
#endif /* __linux__ */
/*
@@ -389,6 +403,9 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, va_list args)
case TSOCKS_NR_EPOLL_CTL:
ret = handle_epoll_ctl(args);
break;
+ case TSOCKS_NR_EVENTFD2:
+ ret = handle_eventfd2(args);
+ break;
#endif /* __linux__ */
default:
/*
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits