diff options
Diffstat (limited to 'sysdeps/generic/pselect.c')
-rw-r--r-- | sysdeps/generic/pselect.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/sysdeps/generic/pselect.c b/sysdeps/generic/pselect.c index 6aa60e8e72..e090d6e526 100644 --- a/sysdeps/generic/pselect.c +++ b/sysdeps/generic/pselect.c @@ -22,6 +22,7 @@ #include <stddef.h> /* For NULL. */ #include <sys/time.h> #include <sys/select.h> +#include <sysdep-cancel.h> /* Check the first NFDS descriptors each in READFDS (if not NULL) for read readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS @@ -29,14 +30,9 @@ after waiting the interval specified therein. Additionally set the sigmask SIGMASK for this call. Returns the number of ready descriptors, or -1 for errors. */ -int -__pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask) - int nfds; - fd_set *readfds; - fd_set *writefds; - fd_set *exceptfds; - const struct timespec *timeout; - const sigset_t *sigmask; +static int +do_pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, + const struct timespec *timeout, const sigset_t *sigmask) { struct timeval tval; int retval; @@ -62,5 +58,28 @@ __pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask) return retval; } + + +int +__pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask) + int nfds; + fd_set *readfds; + fd_set *writefds; + fd_set *exceptfds; + const struct timespec *timeout; + const sigset_t *sigmask; +{ + if (SINGLE_THREAD_P) + return do_pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask); + + int oldtype = LIBC_CANCEL_ASYNC (); + + int result = do_pselect (nfds, readfds, writefds, exceptfds, timeout, + sigmask); + + LIBC_CANCEL_RESET (oldtype); + + return result; +} weak_alias (__pselect, pselect) strong_alias (__pselect, __libc_pselect) |