Browse Source

epoll: Use epoll_pwait if arch does not have the epoll_wait syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Markos Chandras 11 years ago
parent
commit
3db05793b7
2 changed files with 13 additions and 1 deletions
  1. 11 0
      libc/sysdeps/linux/common/epoll.c
  2. 2 1
      libc/sysdeps/linux/common/stubs.c

+ 11 - 0
libc/sysdeps/linux/common/epoll.c

@@ -55,4 +55,15 @@ static int __NC(epoll_pwait)(int epfd, struct epoll_event *events, int maxevents
 CANCELLABLE_SYSCALL(int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout,
 				       const sigset_t *set),
 		    (epfd, events, maxevents, timeout, set))
+/*
+ * If epoll_wait is not defined, then call epoll_pwait instead using NULL
+ * for sigmask argument
+ */
+# ifndef __NR_epoll_wait
+#  include <stddef.h>
+int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
+{
+	return INLINE_SYSCALL(epoll_pwait, 5, epfd, events, maxevents, timeout, NULL);
+}
+# endif
 #endif

+ 2 - 1
libc/sysdeps/linux/common/stubs.c

@@ -107,7 +107,8 @@ make_stub(epoll_ctl)
 make_stub(epoll_pwait)
 #endif
 
-#if !defined __NR_epoll_wait && defined __UCLIBC_HAS_EPOLL__
+#if !defined __NR_epoll_wait && defined __UCLIBC_HAS_EPOLL__ \
+		&& !defined __NR_epoll_pwait
 make_stub(epoll_wait)
 #endif