summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpcbind
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2003-01-16 07:27:30 +0000
committermbr <mbr@FreeBSD.org>2003-01-16 07:27:30 +0000
commitf4b7d5938511f9f869d55eaf04dbfc04edcf0989 (patch)
tree9666afecfbd20dd475ac216552d1c46a292cf343 /usr.sbin/rpcbind
parent247cd2063c55a737d5fd75bc16a9a26a7631f458 (diff)
downloadFreeBSD-src-f4b7d5938511f9f869d55eaf04dbfc04edcf0989.zip
FreeBSD-src-f4b7d5938511f9f869d55eaf04dbfc04edcf0989.tar.gz
Implement nonblocking tpc-connections. rpcgen -m does still
produce backcompatible code. Reviewed by: rwatson Obtained from: NetBSD MFC after: 1 day
Diffstat (limited to 'usr.sbin/rpcbind')
-rw-r--r--usr.sbin/rpcbind/rpcb_svc_com.c8
-rw-r--r--usr.sbin/rpcbind/rpcbind.c11
2 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/rpcbind/rpcb_svc_com.c b/usr.sbin/rpcbind/rpcb_svc_com.c
index 541d168..dbe312e 100644
--- a/usr.sbin/rpcbind/rpcb_svc_com.c
+++ b/usr.sbin/rpcbind/rpcb_svc_com.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rpcb_svc_com.c,v 1.6 2000/08/03 00:07:22 fvdl Exp $ */
+/* $NetBSD: rpcb_svc_com.c,v 1.9 2002/11/08 00:16:39 fvdl Exp $ */
/* $FreeBSD$ */
/*
@@ -1073,6 +1073,7 @@ netbuffree(struct netbuf *ap)
#define MASKVAL (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)
+extern bool_t __svc_clean_idle(fd_set *, int, bool_t);
void
my_svc_run()
@@ -1085,6 +1086,7 @@ my_svc_run()
int i;
#endif
register struct pollfd *p;
+ fd_set cleanfds;
for (;;) {
p = pollfds;
@@ -1106,7 +1108,7 @@ my_svc_run()
fprintf(stderr, ">\n");
}
#endif
- switch (poll_ret = poll(pollfds, nfds, INFTIM)) {
+ switch (poll_ret = poll(pollfds, nfds, 30 * 1000)) {
case -1:
/*
* We ignore all errors, continuing with the assumption
@@ -1114,6 +1116,8 @@ my_svc_run()
* other outside event) and not caused by poll().
*/
case 0:
+ cleanfds = svc_fdset;
+ __svc_clean_idle(&cleanfds, 30, FALSE);
continue;
default:
#ifdef SVC_RUN_DEBUG
diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c
index 21c19b0..ccfd153 100644
--- a/usr.sbin/rpcbind/rpcbind.c
+++ b/usr.sbin/rpcbind/rpcbind.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rpcbind.c,v 1.1 2000/06/02 23:15:42 fvdl Exp $ */
+/* $NetBSD: rpcbind.c,v 1.3 2002/11/08 00:16:40 fvdl Exp $ */
/* $FreeBSD$ */
/*
@@ -57,6 +57,7 @@ static char sccsid[] = "@(#)rpcbind.c 1.35 89/04/21 Copyr 1984 Sun Micro";
#include <sys/socket.h>
#include <sys/un.h>
#include <rpc/rpc.h>
+#include <rpc/rpc_com.h>
#ifdef PORTMAP
#include <netinet/in.h>
#endif
@@ -124,6 +125,7 @@ main(int argc, char *argv[])
struct netconfig *nconf;
void *nc_handle; /* Net config handle */
struct rlimit rl;
+ int maxrec = RPC_MAXDATASIZE;
parseargs(argc, argv);
@@ -165,6 +167,9 @@ main(int argc, char *argv[])
syslog(LOG_ERR, "%s: can't find local transport\n", argv[0]);
exit(1);
}
+
+ rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
+
init_transport(nconf);
while ((nconf = getnetconfig(nc_handle))) {
@@ -431,7 +436,7 @@ init_transport(struct netconfig *nconf)
listen(fd, SOMAXCONN);
my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr,
- 0, 0);
+ RPC_MAXDATASIZE, RPC_MAXDATASIZE);
if (my_xprt == (SVCXPRT *)NULL) {
syslog(LOG_ERR, "%s: could not create service",
nconf->nc_netid);
@@ -491,7 +496,7 @@ init_transport(struct netconfig *nconf)
if (nconf->nc_semantics != NC_TPI_CLTS)
listen(fd, SOMAXCONN);
- my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr, 0, 0);
+ my_xprt = (SVCXPRT *)svc_tli_create(fd, nconf, &taddr, RPC_MAXDATASIZE, RPC_MAXDATASIZE);
if (my_xprt == (SVCXPRT *)NULL) {
syslog(LOG_ERR, "%s: could not create service",
nconf->nc_netid);
OpenPOWER on IntegriCloud