mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
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>
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
1998-06-28 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
|
|
||||||
|
* 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>
|
1998-06-28 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
|
|
||||||
* nscd/connections.c (handle_new_request): Handle POLLHUP
|
* nscd/connections.c (handle_new_request): Handle POLLHUP
|
||||||
|
@@ -55,6 +55,7 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <rpc/pmap_clnt.h>
|
#include <rpc/pmap_clnt.h>
|
||||||
|
|
||||||
@@ -469,28 +470,18 @@ static int
|
|||||||
readtcp (char *ctptr, char *buf, int len)
|
readtcp (char *ctptr, char *buf, int len)
|
||||||
{
|
{
|
||||||
struct ct_data *ct = (struct ct_data *)ctptr;
|
struct ct_data *ct = (struct ct_data *)ctptr;
|
||||||
#ifdef FD_SETSIZE
|
struct pollfd fd;
|
||||||
fd_set mask;
|
int milliseconds = (ct->ct_wait.tv_sec * 1000) +
|
||||||
fd_set readfds;
|
(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)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#endif /* def FD_SETSIZE */
|
fd.fd = ct->ct_sock;
|
||||||
|
fd.events = POLLIN;
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
struct timeval timeout = ct->ct_wait;
|
switch (__poll(&fd, 1, milliseconds))
|
||||||
readfds = mask;
|
|
||||||
switch (select (_rpc_dtablesize (), &readfds, (fd_set*)NULL,
|
|
||||||
(fd_set*)NULL, &timeout))
|
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ct->ct_error.re_status = RPC_TIMEDOUT;
|
ct->ct_error.re_status = RPC_TIMEDOUT;
|
||||||
|
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
|
|||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
#include <rpc/clnt.h>
|
#include <rpc/clnt.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@@ -234,13 +235,9 @@ clntudp_call (cl, proc, xargs, argsp, xresults, resultsp, utimeout)
|
|||||||
int outlen = 0;
|
int outlen = 0;
|
||||||
int inlen;
|
int inlen;
|
||||||
socklen_t fromlen;
|
socklen_t fromlen;
|
||||||
#ifdef FD_SETSIZE
|
struct pollfd fd;
|
||||||
fd_set readfds;
|
int milliseconds = (cu->cu_wait.tv_sec * 1000) +
|
||||||
fd_set mask;
|
(cu->cu_wait.tv_usec / 1000);
|
||||||
#else
|
|
||||||
int readfds;
|
|
||||||
int mask;
|
|
||||||
#endif /* def FD_SETSIZE */
|
|
||||||
struct sockaddr_in from;
|
struct sockaddr_in from;
|
||||||
struct rpc_msg reply_msg;
|
struct rpc_msg reply_msg;
|
||||||
XDR reply_xdrs;
|
XDR reply_xdrs;
|
||||||
@@ -301,18 +298,11 @@ send_again:
|
|||||||
reply_msg.acpted_rply.ar_verf = _null_auth;
|
reply_msg.acpted_rply.ar_verf = _null_auth;
|
||||||
reply_msg.acpted_rply.ar_results.where = resultsp;
|
reply_msg.acpted_rply.ar_results.where = resultsp;
|
||||||
reply_msg.acpted_rply.ar_results.proc = xresults;
|
reply_msg.acpted_rply.ar_results.proc = xresults;
|
||||||
#ifdef FD_SETSIZE
|
fd.fd = cu->cu_sock;
|
||||||
FD_ZERO (&mask);
|
fd.events = POLLIN;
|
||||||
FD_SET (cu->cu_sock, &mask);
|
|
||||||
#else
|
|
||||||
mask = 1 << cu->cu_sock;
|
|
||||||
#endif /* def FD_SETSIZE */
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
struct timeval cu_wait = cu->cu_wait;
|
switch (__poll(&fd, 1, milliseconds))
|
||||||
readfds = mask;
|
|
||||||
switch (select (_rpc_dtablesize (), &readfds, (fd_set*) NULL,
|
|
||||||
(fd_set*) NULL, &cu_wait))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
@@ -45,6 +45,7 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
|
|||||||
#include <rpc/pmap_prot.h>
|
#include <rpc/pmap_prot.h>
|
||||||
#include <rpc/pmap_clnt.h>
|
#include <rpc/pmap_clnt.h>
|
||||||
#include <rpc/pmap_rmt.h>
|
#include <rpc/pmap_rmt.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -240,13 +241,8 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
|
|||||||
socklen_t fromlen;
|
socklen_t fromlen;
|
||||||
int sock;
|
int sock;
|
||||||
int on = 1;
|
int on = 1;
|
||||||
#ifdef FD_SETSIZE
|
struct pollfd fd;
|
||||||
fd_set mask;
|
int milliseconds;
|
||||||
fd_set readfds;
|
|
||||||
#else
|
|
||||||
int readfds;
|
|
||||||
int mask;
|
|
||||||
#endif /* def FD_SETSIZE */
|
|
||||||
int i;
|
int i;
|
||||||
bool_t done = FALSE;
|
bool_t done = FALSE;
|
||||||
u_long xid;
|
u_long xid;
|
||||||
@@ -256,7 +252,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
|
|||||||
struct rmtcallargs a;
|
struct rmtcallargs a;
|
||||||
struct rmtcallres r;
|
struct rmtcallres r;
|
||||||
struct rpc_msg msg;
|
struct rpc_msg msg;
|
||||||
struct timeval t, t1;
|
struct timeval t;
|
||||||
char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE];
|
char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -277,12 +273,8 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
|
|||||||
goto done_broad;
|
goto done_broad;
|
||||||
}
|
}
|
||||||
#endif /* def SO_BROADCAST */
|
#endif /* def SO_BROADCAST */
|
||||||
#ifdef FD_SETSIZE
|
fd.fd = sock;
|
||||||
FD_ZERO (&mask);
|
fd.events = POLLIN;
|
||||||
FD_SET (sock, &mask);
|
|
||||||
#else
|
|
||||||
mask = (1 << sock);
|
|
||||||
#endif /* def FD_SETSIZE */
|
|
||||||
nets = getbroadcastnets (addrs, sock, inbuf);
|
nets = getbroadcastnets (addrs, sock, inbuf);
|
||||||
bzero ((char *) &baddr, sizeof (baddr));
|
bzero ((char *) &baddr, sizeof (baddr));
|
||||||
baddr.sin_family = AF_INET;
|
baddr.sin_family = AF_INET;
|
||||||
@@ -342,10 +334,8 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
|
|||||||
msg.acpted_rply.ar_verf = _null_auth;
|
msg.acpted_rply.ar_verf = _null_auth;
|
||||||
msg.acpted_rply.ar_results.where = (caddr_t) & r;
|
msg.acpted_rply.ar_results.where = (caddr_t) & r;
|
||||||
msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_rmtcallres;
|
msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_rmtcallres;
|
||||||
readfds = mask;
|
milliseconds = t.tv_sec * 1000 + t.tv_usec / 1000;
|
||||||
t1 = t;
|
switch (__poll(&fd, 1, milliseconds))
|
||||||
switch (select (_rpc_dtablesize (), &readfds, (fd_set *) NULL,
|
|
||||||
(fd_set *) NULL, &t1))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
case 0: /* timed out */
|
case 0: /* timed out */
|
||||||
@@ -355,11 +345,11 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
|
|||||||
case -1: /* some kind of error */
|
case -1: /* some kind of error */
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
goto recv_again;
|
goto recv_again;
|
||||||
perror (_("Broadcast select problem"));
|
perror (_("Broadcast poll problem"));
|
||||||
stat = RPC_CANTRECV;
|
stat = RPC_CANTRECV;
|
||||||
goto done_broad;
|
goto done_broad;
|
||||||
|
|
||||||
} /* end of select results switch */
|
} /* end of poll results switch */
|
||||||
try_again:
|
try_again:
|
||||||
fromlen = sizeof (struct sockaddr);
|
fromlen = sizeof (struct sockaddr);
|
||||||
inlen = recvfrom (sock, inbuf, UDPMSGSIZE, 0,
|
inlen = recvfrom (sock, inbuf, UDPMSGSIZE, 0,
|
||||||
|
Reference in New Issue
Block a user