Convert the rest of the code to use pollts for consistency. XXX: We should

really use kqueue.
This commit is contained in:
christos 2005-09-09 15:41:27 +00:00
parent fa92811fc7
commit 68f654dc66
4 changed files with 20 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnt_bcast.c,v 1.13 2005/06/01 04:38:40 lukem Exp $ */
/* $NetBSD: clnt_bcast.c,v 1.14 2005/09/09 15:41:27 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: clnt_bcast.c,v 1.13 2005/06/01 04:38:40 lukem Exp $");
__RCSID("$NetBSD: clnt_bcast.c,v 1.14 2005/09/09 15:41:27 christos Exp $");
#endif
#endif
@ -288,6 +288,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
int msec;
int pollretval;
int fds_found;
struct timespec ts;
#ifdef PORTMAP
size_t outlen_pmap = 0;
@ -516,8 +517,10 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
* Get all the replies from these broadcast requests
*/
recv_again:
ts.tv_sec = msec / 1000;
ts.tv_nsec = (msec % 1000) * 1000000;
switch (pollretval = poll(pfd, fdlistno, msec)) {
switch (pollretval = pollts(pfd, fdlistno, &ts, NULL)) {
case 0: /* timed out */
stat = RPC_TIMEDOUT;
continue;
@ -534,7 +537,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
else if (pfd[i].revents & POLLNVAL) {
/*
* Something bad has happened to this descri-
* ptor. We can cause poll() to ignore
* ptor. We can cause pollts() to ignore
* it simply by using a negative fd. We do that
* rather than compacting the pfd[] and fdlist[]
* arrays.

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnt_vc.c,v 1.11 2004/12/30 05:11:50 christos Exp $ */
/* $NetBSD: clnt_vc.c,v 1.12 2005/09/09 15:41:27 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -36,7 +36,7 @@ static char *sccsid = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC";
static char sccsid[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: clnt_vc.c,v 1.11 2004/12/30 05:11:50 christos Exp $");
__RCSID("$NetBSD: clnt_vc.c,v 1.12 2005/09/09 15:41:27 christos Exp $");
#endif
#endif
@ -679,15 +679,16 @@ read_vc(ctp, buf, len)
{
struct ct_data *ct = (struct ct_data *)(void *)ctp;
struct pollfd fd;
int milliseconds = (int)((ct->ct_wait.tv_sec * 1000) +
(ct->ct_wait.tv_usec / 1000));
struct timespec ts;
if (len == 0)
return (0);
TIMEVAL_TO_TIMESPEC(&ct->ct_wait, &ts);
fd.fd = ct->ct_fd;
fd.events = POLLIN;
for (;;) {
switch (poll(&fd, 1, milliseconds)) {
switch (pollts(&fd, 1, &ts, NULL)) {
case 0:
ct->ct_error.re_status = RPC_TIMEDOUT;
return (-1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: svc.c,v 1.24 2003/01/18 11:29:06 thorpej Exp $ */
/* $NetBSD: svc.c,v 1.25 2005/09/09 15:41:27 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -35,7 +35,7 @@
static char *sccsid = "@(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)svc.c 2.4 88/08/11 4.0 RPCSRC";
#else
__RCSID("$NetBSD: svc.c,v 1.24 2003/01/18 11:29:06 thorpej Exp $");
__RCSID("$NetBSD: svc.c,v 1.25 2005/09/09 15:41:27 christos Exp $");
#endif
#endif
@ -753,7 +753,7 @@ svc_getreq_poll(pfdp, pollretval)
/*
* We assume that this function is only called
* via someone select()ing from svc_fdset or
* poll()ing from svc_pollset[]. Thus it's safe
* pollts()ing from svc_pollset[]. Thus it's safe
* to handle the POLLNVAL event by simply turning
* the corresponding bit off in svc_fdset. The
* svc_pollset[] array is derived from svc_fdset

View File

@ -1,4 +1,4 @@
/* $NetBSD: svc_vc.c,v 1.12 2003/01/18 11:29:07 thorpej Exp $ */
/* $NetBSD: svc_vc.c,v 1.13 2005/09/09 15:41:27 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -35,7 +35,7 @@
static char *sccsid = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";
#else
__RCSID("$NetBSD: svc_vc.c,v 1.12 2003/01/18 11:29:07 thorpej Exp $");
__RCSID("$NetBSD: svc_vc.c,v 1.13 2005/09/09 15:41:27 christos Exp $");
#endif
#endif
@ -484,7 +484,6 @@ read_vc(xprtp, buf, len)
{
SVCXPRT *xprt;
int sock;
int milliseconds = 35 * 1000;
struct pollfd pollfd;
struct sockaddr *sa;
struct msghdr msg;
@ -493,6 +492,7 @@ read_vc(xprtp, buf, len)
struct sockcred *sc;
socklen_t crmsgsize;
struct cf_conn *cfp;
static const struct timespec ts = { 35, 0 };
xprt = (SVCXPRT *)(void *)xprtp;
_DIAGASSERT(xprt != NULL);
@ -552,7 +552,7 @@ read_vc(xprtp, buf, len)
do {
pollfd.fd = sock;
pollfd.events = POLLIN;
switch (poll(&pollfd, 1, milliseconds)) {
switch (pollts(&pollfd, 1, &ts, NULL)) {
case -1:
if (errno == EINTR) {
continue;