From 145ad1d976abff15f32e129e25f47c04807d24ac Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 22 Apr 2011 00:42:58 +0200 Subject: poll, ppoll: use cancel.h use __SYSCALL_SIGSET_T_SIZE use non-cancellable select in fallback Signed-off-by: Peter S. Mazinger Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/ppoll.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'libc/sysdeps/linux/common/ppoll.c') diff --git a/libc/sysdeps/linux/common/ppoll.c b/libc/sysdeps/linux/common/ppoll.c index 3ca3f7333..9135fe523 100644 --- a/libc/sysdeps/linux/common/ppoll.c +++ b/libc/sysdeps/linux/common/ppoll.c @@ -20,19 +20,16 @@ #include #if defined __NR_ppoll && defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU -# define __need_NULL -# include -# include -# include -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# include -# else -# define SINGLE_THREAD_P 1 -# endif - -int -ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, - const sigset_t *sigmask) + +#define __need_NULL +#include +#include +#include +#include + +static int +__NC(ppoll)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, + const sigset_t *sigmask) { /* The Linux kernel can in some situations update the timeout value. We do not want that so use a local variable. */ @@ -41,14 +38,11 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, tval = *timeout; timeout = &tval; } - if (SINGLE_THREAD_P) - return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8); - -# ifdef __UCLIBC_HAS_THREADS_NATIVE__ - int oldtype = LIBC_CANCEL_ASYNC (); - int result = INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8); - LIBC_CANCEL_RESET (oldtype); - return result; -# endif + return INLINE_SYSCALL(ppoll, 5, fds, nfds, timeout, sigmask, __SYSCALL_SIGSET_T_SIZE); } + +CANCELLABLE_SYSCALL(int, ppoll, (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, + const sigset_t *sigmask), + (fds, nfds, timeout, sigmask)) + #endif -- cgit v1.2.3