aboutsummaryrefslogtreecommitdiff
path: root/sunrpc/clnt_tcp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-06-28 09:50:12 +0000
committerUlrich Drepper <drepper@redhat.com>1998-06-28 09:50:12 +0000
commit099a6fbd8a703336c73f6bb7396b77e4a6e31a3e (patch)
tree79dd4ab25a653551ae0df8fba6bd36af0a1314de /sunrpc/clnt_tcp.c
parente47315b4a8f83299df6710585a6d5a650c21e406 (diff)
downloadglibc-099a6fbd8a703336c73f6bb7396b77e4a6e31a3e.zip
glibc-099a6fbd8a703336c73f6bb7396b77e4a6e31a3e.tar.gz
glibc-099a6fbd8a703336c73f6bb7396b77e4a6e31a3e.tar.bz2
Update.
* sunrpc/clnt_tcp.c (readtcp): Use poll instead of select. * sunrpc/pmap_rmt.c (clnt_broadcast): Likewise. * sunrpc/clnt_udp.c (clntudp_call): Likewise. Patches from FreeBSD current. 1998-06-28 Andreas Jaeger <aj@arthur.rhein-neckar.de>
Diffstat (limited to 'sunrpc/clnt_tcp.c')
-rw-r--r--sunrpc/clnt_tcp.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index d4fd7c4..be74f0d 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -55,6 +55,7 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
#include <stdio.h>
#include <unistd.h>
#include <rpc/rpc.h>
+#include <sys/poll.h>
#include <sys/socket.h>
#include <rpc/pmap_clnt.h>
@@ -469,28 +470,18 @@ static int
readtcp (char *ctptr, char *buf, int len)
{
struct ct_data *ct = (struct ct_data *)ctptr;
-#ifdef FD_SETSIZE
- fd_set mask;
- fd_set readfds;
+ struct pollfd fd;
+ int milliseconds = (ct->ct_wait.tv_sec * 1000) +
+ (ct->ct_wait.tv_usec / 1000);
if (len == 0)
return 0;
- FD_ZERO (&mask);
- FD_SET (ct->ct_sock, &mask);
-#else
- int mask = 1 << (ct->ct_sock);
- int readfds;
- if (len == 0)
- return 0;
-
-#endif /* def FD_SETSIZE */
+ fd.fd = ct->ct_sock;
+ fd.events = POLLIN;
while (TRUE)
{
- struct timeval timeout = ct->ct_wait;
- readfds = mask;
- switch (select (_rpc_dtablesize (), &readfds, (fd_set*)NULL,
- (fd_set*)NULL, &timeout))
+ switch (__poll(&fd, 1, milliseconds))
{
case 0:
ct->ct_error.re_status = RPC_TIMEDOUT;