diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1996-12-30 18:41:20 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1996-12-30 18:41:20 +0000 |
| commit | c5bb6008ce039911a5c02f62638ede488a2cffd2 (patch) | |
| tree | bf024b4a17e6c8d8fd134286cc123d50dad27a24 | |
| parent | a7ccaef83f6efc33ef6778f8f56d8569b94f7cc6 (diff) | |
Notes
| -rw-r--r-- | lib/libc/rpc/rpc_dtablesize.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/libc/rpc/rpc_dtablesize.c b/lib/libc/rpc/rpc_dtablesize.c index 7df2e43857d6..77697fef927f 100644 --- a/lib/libc/rpc/rpc_dtablesize.c +++ b/lib/libc/rpc/rpc_dtablesize.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro";*/ /*static char *sccsid = "from: @(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "rpc_dtablesize.c,v 1.1 1994/08/07 18:36:02 wollman Exp"; +static char *rcsid = "$Id$"; #endif #include <sys/types.h> @@ -40,12 +40,22 @@ static char *rcsid = "rpc_dtablesize.c,v 1.1 1994/08/07 18:36:02 wollman Exp"; * Cache the result of getdtablesize(), so we don't have to do an * expensive system call every time. */ +/* + * XXX In FreeBSD 2.x, you can have the maximum number of open file + * descriptors be greater than FD_SETSIZE (which us 256 by default). + * + * Since old programs tend to use this call to determine the first arg + * for select(), having this return > FD_SETSIZE is a Bad Idea(TM)! + */ int -_rpc_dtablesize() +_rpc_dtablesize(void) { static int size; - if (size == 0) + if (size == 0) { size = getdtablesize(); + if (size > FD_SETSIZE) + size = FD_SETSIZE; + } return (size); } |
