diff --git a/include/sys/poll.h b/include/sys/poll.h index 3d9cd22..f0d594c 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -24,6 +24,10 @@ #ifndef _FEATURES_H # include #endif +#ifdef __USE_GNU +# include +# include +#endif __BEGIN_DECLS @@ -54,8 +58,18 @@ struct pollfd or -1 for errors. */ extern int poll (struct pollfd *__fds, nfds_t __nfds, __int32_t __timeout) __THROW; -extern int __poll (struct pollfd *__fds, nfds_t __nfds, - __int32_t __timeout) __THROW; + +#ifdef __USE_GNU +/* Like poll, but before waiting the threads signal mask is replaced + with that specified in the fourth parameter. For better usability, + the timeout value is specified using a TIMESPEC object. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int ppoll (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss); +#endif __END_DECLS diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c index 5993e39..580589a 100644 --- a/sunrpc/pmap_rmt.c +++ b/sunrpc/pmap_rmt.c @@ -350,7 +350,7 @@ clnt_broadcast ( msg.acpted_rply.ar_results.where = (caddr_t) & r; msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_rmtcallres; milliseconds = t.tv_sec * 1000 + t.tv_usec / 1000; - switch (__poll(&fd, 1, milliseconds)) + switch (poll(&fd, 1, milliseconds)) { case 0: /* timed out */ diff --git a/sunrpc/rtime.c b/sunrpc/rtime.c index 62cc679..d24bef5 100644 --- a/sunrpc/rtime.c +++ b/sunrpc/rtime.c @@ -109,7 +109,7 @@ rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep, fd.fd = s; fd.events = POLLIN; do - res = __poll (&fd, 1, milliseconds); + res = poll (&fd, 1, milliseconds); while (res < 0 && errno == EINTR); if (res <= 0) { diff --git a/sunrpc/svc_run.c b/sunrpc/svc_run.c index 8459743..e4e46c8 100644 --- a/sunrpc/svc_run.c +++ b/sunrpc/svc_run.c @@ -74,7 +74,7 @@ svc_run (void) my_pollfd[i].revents = 0; } - switch (i = __poll (my_pollfd, svc_max_pollfd, -1)) + switch (i = poll (my_pollfd, svc_max_pollfd, -1)) { case -1: free (my_pollfd); diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c index 156ddd6..b7abe76 100644 --- a/sunrpc/svc_tcp.c +++ b/sunrpc/svc_tcp.c @@ -313,7 +313,7 @@ readtcp (char *xprtptr, char *buf, int len) { pollfd.fd = sock; pollfd.events = POLLIN; - switch (__poll (&pollfd, 1, milliseconds)) + switch (poll (&pollfd, 1, milliseconds)) { case -1: if (errno == EINTR) diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c index e7c8daf..8cd9544 100644 --- a/sunrpc/svc_unix.c +++ b/sunrpc/svc_unix.c @@ -413,7 +413,7 @@ readunix (char *xprtptr, char *buf, int len) { pollfd.fd = sock; pollfd.events = POLLIN; - switch (__poll (&pollfd, 1, milliseconds)) + switch (poll (&pollfd, 1, milliseconds)) { case -1: if (errno == EINTR) diff --git a/unix/SRCFILES b/unix/SRCFILES index 6ffd143..5bd9e1b 100644 --- a/unix/SRCFILES +++ b/unix/SRCFILES @@ -65,6 +65,7 @@ SRCFILES = \ pause.c \ pipe.c \ poll.c \ + ppoll.c \ ptrace.c \ read.c \ readlink.c \ diff --git a/unix/select.c b/unix/select.c index c2a459b..e14087e 100644 --- a/unix/select.c +++ b/unix/select.c @@ -16,6 +16,8 @@ #include #include +__typeof__(poll) __poll; + /* 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 (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out