Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/rpc make this usable from RUMP



details:   https://anonhg.NetBSD.org/src/rev/e058de8a4190
branches:  trunk
changeset: 785240:e058de8a4190
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 05 19:55:22 2013 +0000

description:
make this usable from RUMP

diffstat:

 lib/libc/rpc/bindresvport.c |   5 ++-
 lib/libc/rpc/clnt_bcast.c   |   5 ++-
 lib/libc/rpc/clnt_dg.c      |  11 ++++++-
 lib/libc/rpc/clnt_generic.c |   6 ++-
 lib/libc/rpc/clnt_vc.c      |   5 ++-
 lib/libc/rpc/rpc_generic.c  |   6 ++-
 lib/libc/rpc/rpc_soc.c      |   5 ++-
 lib/libc/rpc/rpcb_clnt.c    |   5 ++-
 lib/libc/rpc/svc.c          |  20 +++++++------
 lib/libc/rpc/svc_dg.c       |   7 ++--
 lib/libc/rpc/svc_fdset.c    |  63 +++++++++++++++++++++++++++++++++++++++++++++
 lib/libc/rpc/svc_fdset.h    |  30 +++++++++++++++++++++
 lib/libc/rpc/svc_generic.c  |   5 ++-
 lib/libc/rpc/svc_run.c      |  29 +++++++++++++++-----
 lib/libc/rpc/svc_vc.c       |   7 ++--
 15 files changed, 169 insertions(+), 40 deletions(-)

diffs (truncated from 565 to 300 lines):

diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/bindresvport.c
--- a/lib/libc/rpc/bindresvport.c       Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/bindresvport.c       Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bindresvport.c,v 1.23 2012/03/20 17:14:50 matt Exp $   */
+/*     $NetBSD: bindresvport.c,v 1.24 2013/03/05 19:55:22 christos Exp $       */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
 static char *sccsid = "@(#)bindresvport.c 1.8 88/02/08 SMI";
 static char *sccsid = "@(#)bindresvport.c      2.2 88/07/29 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: bindresvport.c,v 1.23 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: bindresvport.c,v 1.24 2013/03/05 19:55:22 christos Exp $");
 #endif
 #endif
 
@@ -55,6 +55,7 @@
 #include <unistd.h>
 
 #include <rpc/rpc.h>
+#include "svc_fdset.h"
 
 #ifdef __weak_alias
 __weak_alias(bindresvport,_bindresvport)
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/clnt_bcast.c
--- a/lib/libc/rpc/clnt_bcast.c Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/clnt_bcast.c Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clnt_bcast.c,v 1.24 2012/03/20 17:14:50 matt Exp $     */
+/*     $NetBSD: clnt_bcast.c,v 1.25 2013/03/05 19:55:22 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.24 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: clnt_bcast.c,v 1.25 2013/03/05 19:55:22 christos Exp $");
 #endif
 #endif
 
@@ -81,6 +81,7 @@
 #include <string.h>
 
 #include "rpc_internal.h"
+#include "svc_fdset.h"
 
 #define        MAXBCAST 20     /* Max no of broadcasting transports */
 #define        INITTIME 4000   /* Time to wait initially */
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/clnt_dg.c
--- a/lib/libc/rpc/clnt_dg.c    Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/clnt_dg.c    Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clnt_dg.c,v 1.26 2012/03/20 17:14:50 matt Exp $        */
+/*     $NetBSD: clnt_dg.c,v 1.27 2013/03/05 19:55:22 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_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro";
 #else
-__RCSID("$NetBSD: clnt_dg.c,v 1.26 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: clnt_dg.c,v 1.27 2013/03/05 19:55:22 christos Exp $");
 #endif
 #endif
 
@@ -62,6 +62,8 @@
 #include <signal.h>
 #include <unistd.h>
 #include <err.h>
+
+#include "svc_fdset.h"
 #include "rpc_internal.h"
 
 #ifdef __weak_alias
@@ -247,8 +249,13 @@
        cu->cu_rlen = svcaddr->len;
        cu->cu_outbuf = &cu->cu_inbuf[recvsz];
        /* Other values can also be set through clnt_control() */
+#ifdef RUMP_RPC
        cu->cu_wait.tv_sec = 15;        /* heuristically chosen */
        cu->cu_wait.tv_usec = 0;
+#else
+       cu->cu_wait.tv_sec = 0;         /* for testing, 10x / second */
+       cu->cu_wait.tv_usec = 100000;
+#endif
        cu->cu_total.tv_sec = -1;
        cu->cu_total.tv_usec = -1;
        cu->cu_sendsz = sendsz;
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/clnt_generic.c
--- a/lib/libc/rpc/clnt_generic.c       Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/clnt_generic.c       Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clnt_generic.c,v 1.28 2012/03/20 17:14:50 matt Exp $   */
+/*     $NetBSD: clnt_generic.c,v 1.29 2013/03/05 19:55:22 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_generic.c 1.32 89/03/16 Copyr 1988 Sun Micro";
 #else
-__RCSID("$NetBSD: clnt_generic.c,v 1.28 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: clnt_generic.c,v 1.29 2013/03/05 19:55:22 christos Exp $");
 #endif
 #endif
 
@@ -56,6 +56,8 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+
+#include "svc_fdset.h"
 #include "rpc_internal.h"
 
 #ifdef __weak_alias
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/clnt_vc.c
--- a/lib/libc/rpc/clnt_vc.c    Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/clnt_vc.c    Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clnt_vc.c,v 1.19 2013/02/26 16:33:57 christos Exp $    */
+/*     $NetBSD: clnt_vc.c,v 1.20 2013/03/05 19:55:22 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  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.19 2013/02/26 16:33:57 christos Exp $");
+__RCSID("$NetBSD: clnt_vc.c,v 1.20 2013/03/05 19:55:22 christos Exp $");
 #endif
 #endif
  
@@ -77,6 +77,7 @@
 
 #include <rpc/rpc.h>
 
+#include "svc_fdset.h"
 #include "rpc_internal.h"
 
 #ifdef __weak_alias
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/rpc_generic.c
--- a/lib/libc/rpc/rpc_generic.c        Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/rpc_generic.c        Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_generic.c,v 1.26 2012/03/20 17:14:50 matt Exp $    */
+/*     $NetBSD: rpc_generic.c,v 1.27 2013/03/05 19:55:22 christos Exp $        */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: rpc_generic.c,v 1.26 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: rpc_generic.c,v 1.27 2013/03/05 19:55:22 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -64,6 +64,8 @@
 #include <string.h>
 #include <syslog.h>
 #include <rpc/nettype.h>
+
+#include "svc_fdset.h"
 #include "rpc_internal.h"
 
 #ifdef __weak_alias
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/rpc_soc.c
--- a/lib/libc/rpc/rpc_soc.c    Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/rpc_soc.c    Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_soc.c,v 1.16 2012/06/25 22:32:45 abs Exp $ */
+/*     $NetBSD: rpc_soc.c,v 1.17 2013/03/05 19:55:22 christos Exp $    */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_soc.c 1.41 89/05/02 Copyr 1988 Sun Micro";
 #else
-__RCSID("$NetBSD: rpc_soc.c,v 1.16 2012/06/25 22:32:45 abs Exp $");
+__RCSID("$NetBSD: rpc_soc.c,v 1.17 2013/03/05 19:55:22 christos Exp $");
 #endif
 #endif
 
@@ -75,6 +75,7 @@
 #include <syslog.h>
 #include <unistd.h>
 
+#include "svc_fdset.h"
 #include "rpc_internal.h"
 
 #ifdef __weak_alias
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/rpcb_clnt.c
--- a/lib/libc/rpc/rpcb_clnt.c  Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/rpcb_clnt.c  Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpcb_clnt.c,v 1.27 2012/03/20 17:14:50 matt Exp $      */
+/*     $NetBSD: rpcb_clnt.c,v 1.28 2013/03/05 19:55:22 christos Exp $  */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rpcb_clnt.c 1.30 89/06/21 Copyr 1988 Sun Micro";
 #else
-__RCSID("$NetBSD: rpcb_clnt.c,v 1.27 2012/03/20 17:14:50 matt Exp $");
+__RCSID("$NetBSD: rpcb_clnt.c,v 1.28 2013/03/05 19:55:22 christos Exp $");
 #endif
 #endif
 
@@ -73,6 +73,7 @@
 #include <syslog.h>
 #include <unistd.h>
 
+#include "svc_fdset.h"
 #include "rpc_internal.h"
 
 #ifdef __weak_alias
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/svc.c
--- a/lib/libc/rpc/svc.c        Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/svc.c        Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svc.c,v 1.32 2013/03/04 17:29:03 christos Exp $        */
+/*     $NetBSD: svc.c,v 1.33 2013/03/05 19:55:23 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.32 2013/03/04 17:29:03 christos Exp $");
+__RCSID("$NetBSD: svc.c,v 1.33 2013/03/05 19:55:23 christos Exp $");
 #endif
 #endif
 
@@ -64,6 +64,7 @@
 #include <rpc/pmap_clnt.h>
 #endif
 
+#include "svc_fdset.h"
 #include "rpc_internal.h"
 
 #ifdef __weak_alias
@@ -149,8 +150,8 @@
                goto out;
        }
        __svc_xports[sock] = xprt;
-       FD_SET(sock, &svc_fdset);
-       svc_maxfd = max(svc_maxfd, sock);
+       FD_SET(sock, get_fdset());
+       *get_fdsetmax() = max(*get_fdsetmax(), sock);
        rwlock_unlock(&svc_fd_lock);
        return (TRUE);
 
@@ -187,10 +188,11 @@
                rwlock_wrlock(&svc_fd_lock);
        if ((sock < FD_SETSIZE) && (__svc_xports[sock] == xprt)) {
                __svc_xports[sock] = NULL;
-               FD_CLR(sock, &svc_fdset);
-               if (sock >= svc_maxfd) {
-                       for (svc_maxfd--; svc_maxfd>=0; svc_maxfd--)
-                               if (__svc_xports[svc_maxfd])
+               FD_CLR(sock, get_fdset());
+               if (sock >= *get_fdsetmax()) {
+                       for ((*get_fdsetmax())--; *get_fdsetmax() >= 0;
+                           (*get_fdsetmax())--)
+                               if (__svc_xports[*get_fdsetmax()])
                                        break;
                }
        }
@@ -736,7 +738,7 @@
                         */
                        if (p->revents & POLLNVAL) {
                                rwlock_wrlock(&svc_fd_lock);
-                               FD_CLR(p->fd, &svc_fdset);
+                               FD_CLR(p->fd, get_fdset());
                                rwlock_unlock(&svc_fd_lock);
                        } else
                                svc_getreq_common(p->fd);
diff -r a96b0009d76e -r e058de8a4190 lib/libc/rpc/svc_dg.c
--- a/lib/libc/rpc/svc_dg.c     Tue Mar 05 16:54:08 2013 +0000
+++ b/lib/libc/rpc/svc_dg.c     Tue Mar 05 19:55:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svc_dg.c,v 1.15 2013/03/04 17:29:03 christos Exp $     */
+/*     $NetBSD: svc_dg.c,v 1.16 2013/03/05 19:55:23 christos Exp $     */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -44,7 +44,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)



Home | Main Index | Thread Index | Old Index