summary refs log tree commit diff
path: root/sunrpc/svc_unix.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-11-18 11:05:09 +0000
committerUlrich Drepper <drepper@redhat.com>1998-11-18 11:05:09 +0000
commit090ca0002ff8ee4ca425bc6088cc097f46c67626 (patch)
tree6d74050e9ba355a9d91de5251c9f854f8fce4098 /sunrpc/svc_unix.c
parent45a9a50e68f58102e86b949527fd0c2bc0abf4ce (diff)
downloadglibc-090ca0002ff8ee4ca425bc6088cc097f46c67626.tar.gz
glibc-090ca0002ff8ee4ca425bc6088cc097f46c67626.tar.xz
glibc-090ca0002ff8ee4ca425bc6088cc097f46c67626.zip
Update.
1998-11-18  Ulrich Drepper  <drepper@cygnus.com>

	* io/Makefile (CFLAGS-ftw.c): Removed.

1998-11-18  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* io/Makefile (tests): Make sure that the test program has an
	explicit directory part.

1998-11-18  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>

	* configure.in: Fix last change.

1998-11-18  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* 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.
Diffstat (limited to 'sunrpc/svc_unix.c')
-rw-r--r--sunrpc/svc_unix.c54
1 files changed, 16 insertions, 38 deletions
diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c
index 9ee64d0303..4fba428926 100644
--- a/sunrpc/svc_unix.c
+++ b/sunrpc/svc_unix.c
@@ -43,6 +43,7 @@
 #include <rpc/rpc.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
+#include <sys/poll.h>
 #include <errno.h>
 #include <stdlib.h>
 
@@ -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);