Skip to content

Commit

Permalink
Implement ppoll()
Browse files Browse the repository at this point in the history
  • Loading branch information
th-otto committed Oct 8, 2024
1 parent 1fd0b4e commit 2f725bb
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 7 deletions.
18 changes: 16 additions & 2 deletions include/sys/poll.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#ifndef _FEATURES_H
# include <features.h>
#endif
#ifdef __USE_GNU
# include <bits/types/sigset_t.h>
# include <sys/time.h>
#endif

__BEGIN_DECLS

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion sunrpc/pmap_rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion sunrpc/rtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion sunrpc/svc_run.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sunrpc/svc_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sunrpc/svc_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions unix/SRCFILES
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ SRCFILES = \
pause.c \
pipe.c \
poll.c \
ppoll.c \
ptrace.c \
read.c \
readlink.c \
Expand Down
2 changes: 2 additions & 0 deletions unix/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <string.h>
#include <errno.h>

__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
Expand Down

0 comments on commit 2f725bb

Please sign in to comment.