diff options
| author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2007-11-22 16:09:55 +0000 |
|---|---|---|
| committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2007-11-22 16:09:55 +0000 |
| commit | f90eda6523848d835adbe7bef598a86a72b1b22a (patch) | |
| tree | ed6b799ce413dbd67251144be47f7cfe8a5fb746 /libc/sysdeps/linux/common/poll.c | |
| parent | 0957a1a07cba013759ac2067979e6792f804af90 (diff) | |
| download | uClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.bz2 uClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.xz | |
Push back changes to add cancellation handling.
It still needs to reach an agreement on the final
solution, anyway this code have been put int to be shared
for the mips-sh4 merge
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/sysdeps/linux/common/poll.c')
| -rw-r--r-- | libc/sysdeps/linux/common/poll.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 61c6d18ea..7ce1446f5 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -20,31 +20,33 @@ #include "syscalls.h" #include <sys/poll.h> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include <sysdep-cancel.h> +#else +#define SINGLE_THREAD_P 1 +#endif + libc_hidden_proto(poll) #ifdef __NR_poll -# ifdef __UCLIBC__HAS_THREADS__ -# include <sysdep-cancel.h> - -/* The real implementation. */ -int poll (struct pollfd *fds, nfsd_t nfds, int timeout) -{ - if (SINGLE_THREAD_P) - return INLINE_SYSCALL (poll, 3, fds, nfds, timeout); - - int oldtype = LIBC_CANCEL_ASYNC (); - int result = INLINE_SYSCALL (poll, 3, fds, nfds, timeout); +#define __NR___syscall_poll __NR_poll +static inline _syscall3(int, __syscall_poll, struct pollfd *, fds, + unsigned long int, nfds, int, timeout); - LIBC_CANCEL_RESET (oldtype); - - return result; +int poll(struct pollfd *fds, nfds_t nfds, int timeout) +{ + if (SINGLE_THREAD_P) + return __syscall_poll(fds, nfds, timeout); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __syscall_poll(fds, nfds, timeout); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif } -# else -_syscall3(int, poll, struct pollfd *, fds, - unsigned long int, nfds, int, timeout); -# endif -#else +#else /* !__NR_poll */ #include <alloca.h> #include <sys/types.h> |
