From 090ca0002ff8ee4ca425bc6088cc097f46c67626 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 18 Nov 1998 11:05:09 +0000 Subject: Update. 1998-11-18 Ulrich Drepper * io/Makefile (CFLAGS-ftw.c): Removed. 1998-11-18 Andreas Schwab * io/Makefile (tests): Make sure that the test program has an explicit directory part. 1998-11-18 Andreas Schwab * configure.in: Fix last change. 1998-11-18 Thorsten Kukuk * sunrpc/Makefile (routines): Add create_xid. * sunrpc/clnt_tcp.c: Use non-guessable xid. * sunrpc/clnt_udp.c: Likewise. * sunrpc/clnt_unix.c: Likewise. * sunrpc/pmap_rmt.c: Likewise. * sunrpc/create_xid.c: New, create non-guessable xid. * sunrpc/svc_tcp.c: Remove patch from 1998-06-15, use poll instead of select. * sunrpc/svc_unix.c: Use poll instead of select. --- sunrpc/svc_unix.c | 54 ++++++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) (limited to 'sunrpc/svc_unix.c') diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c index 9ee64d0..4fba428 100644 --- a/sunrpc/svc_unix.c +++ b/sunrpc/svc_unix.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -352,12 +353,6 @@ __msgwrite (int sock, void *buf, size_t cnt) } /* - * All read operations timeout after 35 seconds. - * A timeout is fatal for the connection. - */ -static struct timeval wait_per_try = {35, 0}; - -/* * reads data from the unix connection. * any error is fatal and the connection is closed. * (And a read of zero bytes is a half closed stream => error.) @@ -367,38 +362,26 @@ readunix (char *xprtptr, char *buf, int len) { SVCXPRT *xprt = (SVCXPRT *) xprtptr; int sock = xprt->xp_sock; -#ifdef FD_SETSIZE - fd_set readfds; -#else - int mask = 1 << sock; - int readfds; -#endif /* def FD_SETSIZE */ - while (1) + int milliseconds = 35 * 1000; + struct pollfd pollfd; + + do { - struct timeval timeout = wait_per_try; - readfds = svc_fdset; -#ifdef FD_SETSIZE - FD_SET (sock, &readfds); -#else - readfds |= (1 << sock); -#endif /* def FD_SETSIZE */ - if (__select (_rpc_dtablesize (), &readfds, (fd_set *) NULL, - (fd_set *) NULL, &timeout) <= 0) + pollfd.fd = sock; + pollfd.events = POLLIN; + switch (__poll (&pollfd, 1, milliseconds)) { + case -1: if (errno == EINTR) continue; + /*FALLTHROUGH*/ + case 0: goto fatal_err; + default: + break; } - -#ifdef FD_SETSIZE - if (FD_ISSET (sock, &readfds)) -#else - if (readfds == mask) -#endif /* def FD_SETSIZE */ - break; - - svc_getreqset (&readfds); } + while ((pollfd.revents & POLLIN) == 0); if ((len = __msgread (sock, buf, len)) > 0) return len; @@ -471,10 +454,7 @@ svcunix_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) } static bool_t -svcunix_freeargs (xprt, xdr_args, args_ptr) - SVCXPRT *xprt; - xdrproc_t xdr_args; - caddr_t args_ptr; +svcunix_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) { XDR *xdrs = &(((struct unix_conn *) (xprt->xp_p1))->xdrs); @@ -483,9 +463,7 @@ svcunix_freeargs (xprt, xdr_args, args_ptr) } static bool_t -svcunix_reply (xprt, msg) - SVCXPRT *xprt; - struct rpc_msg *msg; +svcunix_reply (SVCXPRT *xprt, struct rpc_msg *msg) { struct unix_conn *cd = (struct unix_conn *) (xprt->xp_p1); XDR *xdrs = &(cd->xdrs); -- cgit v1.1