|
@@ -20,31 +20,14 @@
|
|
|
#include <sys/syscall.h>
|
|
|
#include <sys/poll.h>
|
|
|
#include <bits/kernel-features.h>
|
|
|
-
|
|
|
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
|
|
|
-#include <sysdep-cancel.h>
|
|
|
-#else
|
|
|
-#define SINGLE_THREAD_P 1
|
|
|
-#endif
|
|
|
+#include <cancel.h>
|
|
|
|
|
|
#if defined __ASSUME_POLL_SYSCALL && defined __NR_poll
|
|
|
|
|
|
-#define __NR___syscall_poll __NR_poll
|
|
|
-static _syscall3(int, __syscall_poll, struct pollfd *, fds,
|
|
|
- unsigned long int, nfds, int, timeout);
|
|
|
+#define __NR___poll_nocancel __NR_poll
|
|
|
+static _syscall3(int, __NC(poll), struct pollfd *, fds,
|
|
|
+ unsigned long int, nfds, int, timeout)
|
|
|
|
|
|
-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
|
|
|
|
|
|
#include <alloca.h>
|
|
@@ -54,6 +37,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
#include <sys/time.h>
|
|
|
#include <sys/param.h>
|
|
|
#include <unistd.h>
|
|
|
+#include <sys/select.h>
|
|
|
|
|
|
|
|
|
|
|
@@ -63,7 +47,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
Returns the number of file descriptors with events, zero if timed out,
|
|
|
or -1 for errors. */
|
|
|
|
|
|
-int poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
+int __NC(poll)(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
{
|
|
|
static int max_fd_size;
|
|
|
struct timeval tv;
|
|
@@ -134,7 +118,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
|
|
|
while (1)
|
|
|
{
|
|
|
- ready = select (maxfd + 1, rset, wset, xset,
|
|
|
+ ready = __NC(select) (maxfd + 1, rset, wset, xset,
|
|
|
timeout == -1 ? NULL : &tv);
|
|
|
|
|
|
|
|
@@ -177,7 +161,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
if (f->events & POLLPRI)
|
|
|
FD_SET (f->fd, sngl_xset);
|
|
|
|
|
|
- n = select (f->fd + 1, sngl_rset, sngl_wset, sngl_xset,
|
|
|
+ n = __NC(select) (f->fd + 1, sngl_rset, sngl_wset, sngl_xset,
|
|
|
&sngl_tv);
|
|
|
if (n != -1)
|
|
|
{
|
|
@@ -222,4 +206,6 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
-libc_hidden_def(poll)
|
|
|
+CANCELLABLE_SYSCALL(int, poll, (struct pollfd *fds, nfds_t nfds, int timeout),
|
|
|
+ (fds, nfds, timeout))
|
|
|
+lt_libc_hidden(poll)
|