[git commit future] epoll.c: add cancellation to epoll_[p]wait()

Peter S. Mazinger ps.m at gmx.net
Thu May 12 10:26:41 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=0b7c3a5cab04dff56f697effaf827a64d5d4f26a
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

While there, fix epoll_pwait syscall, it takes 6 arguments

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 libc/sysdeps/linux/common/epoll.c         |   25 +++++++++++++++++++++----
 libpthread/linuxthreads.old/wrapsyscall.c |   13 +++++++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c
index c889c88..29b4600 100644
--- a/libc/sysdeps/linux/common/epoll.c
+++ b/libc/sysdeps/linux/common/epoll.c
@@ -9,6 +9,7 @@
 
 #include <sys/syscall.h>
 #include <sys/epoll.h>
+#include <cancel.h>
 
 #ifdef __NR_epoll_create
 _syscall1(int, epoll_create, int, size)
@@ -23,11 +24,27 @@ _syscall4(int, epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, eve
 #endif
 
 #ifdef __NR_epoll_wait
-_syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout)
-/* TODO: add cancellation for epoll_wait */
+static int __NC(epoll_wait)(int epfd, struct epoll_event *events, int maxevents, int timeout)
+{
+	return INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout);
+}
+CANCELLABLE_SYSCALL(int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout),
+		    (epfd, events, maxevents, timeout))
 #endif
 
 #ifdef __NR_epoll_pwait
-_syscall5(int, epoll_pwait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout, __const sigset_t *, ss)
-/* TODO: add cancellation for epoll_pwait */
+# include <signal.h>
+
+# define __NR___syscall_epoll_pwait __NR_epoll_pwait
+static __always_inline _syscall6(int, __syscall_epoll_pwait, int, epfd, struct epoll_event *, events,
+				 int, maxevents, int, timeout, const sigset_t *, sigmask, size_t, sigsetsize)
+
+static int __NC(epoll_pwait)(int epfd, struct epoll_event *events, int maxevents, int timeout,
+			     const sigset_t *set)
+{
+	return __syscall_epoll_pwait(epfd, events, maxevents, timeout, set, __SYSCALL_SIGSET_T_SIZE);
+}
+CANCELLABLE_SYSCALL(int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout,
+				       const sigset_t *set),
+		    (epfd, events, maxevents, timeout, set))
 #endif
diff --git a/libpthread/linuxthreads.old/wrapsyscall.c b/libpthread/linuxthreads.old/wrapsyscall.c
index d2ac621..5ee976d 100644
--- a/libpthread/linuxthreads.old/wrapsyscall.c
+++ b/libpthread/linuxthreads.old/wrapsyscall.c
@@ -238,3 +238,16 @@ CANCELABLE_SYSCALL (ssize_t, sendto, (int fd, const __ptr_t buf, size_t n,
 				      socklen_t addr_len),
 		    (fd, buf, n, flags, addr, addr_len))
 #endif /* __UCLIBC_HAS_SOCKET__ */
+
+#ifdef  __UCLIBC_HAS_EPOLL__
+# ifdef __NR_epoll_wait
+CANCELABLE_SYSCALL (int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout),
+		    (epfd, events, maxevents, timeout))
+# endif
+# ifdef __NR_epoll_pwait
+#  include <signal.h>
+CANCELABLE_SYSCALL (int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout,
+				       const sigset_t *set),
+		    (epfd, events, maxevents, timeout, set))
+# endif
+#endif
-- 
1.7.3.4



More information about the uClibc-cvs mailing list