From d3c7d64dcafed28e6581e02e7e3d3be0f717d294 Mon Sep 17 00:00:00 2001 From: millert <> Date: Wed, 31 Dec 2003 03:27:23 +0000 Subject: [PATCH] Implement svc_getreq_poll(3) and friends and use poll(2) instead of select(2) in the libc rpc code. The main difference between this and the previous version is the use of a simple free list that simplifies the logic when adding a socket to svc_pollfd. I've also added code to pack svc_pollfd when the free list gets too big. The idea general idea is to keep svc_pollfd as tightly packed as possible to make poll(2) efficient. Tested by many people and OK deraadt@ --- src/include/rpc/svc.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/include/rpc/svc.h b/src/include/rpc/svc.h index d41951bc..717a27c7 100644 --- a/src/include/rpc/svc.h +++ b/src/include/rpc/svc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: svc.h,v 1.7 2002/02/17 19:42:21 millert Exp $ */ +/* $OpenBSD: svc.h,v 1.8 2003/12/31 03:27:23 millert Exp $ */ /* $NetBSD: svc.h,v 1.9 1995/04/29 05:28:01 cgd Exp $ */ /* @@ -42,6 +42,7 @@ #ifndef _RPC_SVC_H #define _RPC_SVC_H #include +#include /* * This interface must manage two items concerning remote procedure calling: @@ -260,13 +261,11 @@ __END_DECLS * Global keeper of rpc service descriptors in use * dynamic; must be inspected before each call to select */ -extern int svc_maxfd; -#ifdef FD_SETSIZE extern fd_set svc_fdset; #define svc_fds svc_fdset.fds_bits[0] /* compatibility */ -#else -extern int svc_fds; -#endif /* def FD_SETSIZE */ +extern struct pollfd *svc_pollfd; +extern int svc_max_pollfd; +extern int svc_maxfd; /* non-standard */ /* * a small program implemented by the svc_rpc implementation itself; @@ -276,6 +275,8 @@ extern void rpctest_service(); /* XXX relic? */ __BEGIN_DECLS extern void svc_getreq(int); +extern void svc_getreq_common(int); +extern void svc_getreq_poll(struct pollfd *, const int); extern void svc_getreqset(fd_set *); extern void svc_getreqset2(fd_set *, int); extern void svc_run(void);