A patch for sunrpc
H . J . Lu
hjl@valinux.com
Fri Mar 31 17:02:00 GMT 2000
This patch allows people to increase NR_OPEN in kernel. However,
fd_set is still hardcoded to 1024bits in glibc.
--
H.J. Lu (hjl@gnu.org)
---
2000-03-31 H.J. Lu <hjl@gnu.org>
* sunrpc/rpc_dtable.c (_rpc_dtablesize): Return FD_SETSIZE if
it is smaller than __getdtablesize ().
* sunrpc/rpc_main.c (s_output): Don't include <unistd.h>
for getdtablesize ().
* sunrpc/rpc_svcout.c (write_timeout_func): Call
_rpc_dtablesize () instead of getdtablesize ().
Index: sunrpc/rpc_dtable.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/sunrpc/rpc_dtable.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 rpc_dtable.c
--- sunrpc/rpc_dtable.c 1998/07/17 17:31:20 1.1.1.3
+++ sunrpc/rpc_dtable.c 2000/03/31 23:50:41
@@ -32,6 +32,7 @@ static char sccsid[] = "@(#)rpc_dtablesi
#endif
#include <unistd.h>
+#include <sys/types.h>
/*
* Cache the result of getdtablesize(), so we don't have to do an
@@ -43,7 +44,16 @@ _rpc_dtablesize (void)
static int size;
if (size == 0)
- size = __getdtablesize ();
+ {
+ size = __getdtablesize ();
+#ifdef FD_SETSIZE
+ if (size > FD_SETSIZE)
+ size = FD_SETSIZE;
+#else
+ if (size > sizeof (int) * 8)
+ size = sizeof (int) * 8;
+#endif
+ }
return size;
}
Index: sunrpc/rpc_main.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/sunrpc/rpc_main.c,v
retrieving revision 1.1.1.10
diff -u -p -r1.1.1.10 rpc_main.c
--- sunrpc/rpc_main.c 1999/01/30 00:01:21 1.1.1.10
+++ sunrpc/rpc_main.c 2000/03/31 23:41:19
@@ -719,10 +719,9 @@ s_output (int argc, const char *argv[],
fprintf (fout, "#include <sys/types.h> /* open */\n");
fprintf (fout, "#include <sys/stat.h> /* open */\n");
fprintf (fout, "#include <fcntl.h> /* open */\n");
- fprintf (fout, "#include <unistd.h> /* getdtablesize */\n");
#else
fprintf (fout, "#ifdef __cplusplus\n");
- fprintf (fout, "#include <sysent.h> /* getdtablesize, open */\n");
+ fprintf (fout, "#include <sysent.h> /* open */\n");
fprintf (fout, "#endif /* __cplusplus */\n");
if (tirpcflag)
fprintf (fout, "#include <unistd.h> /* setsid */\n");
Index: sunrpc/rpc_svcout.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/sunrpc/rpc_svcout.c,v
retrieving revision 1.1.1.7
diff -u -p -r1.1.1.7 rpc_svcout.c
--- sunrpc/rpc_svcout.c 1998/12/01 20:27:27 1.1.1.7
+++ sunrpc/rpc_svcout.c 2000/03/31 23:42:17
@@ -861,7 +861,7 @@ write_timeout_func (void)
}
else
{
- f_print (fout, "\t\t\tsize = getdtablesize();\n");
+ f_print (fout, "\t\t\tsize = _rpc_dtablesize();\n");
}
f_print (fout, "\t\t}\n");
f_print (fout, "\t\tfor (i = 0, openfd = 0; i < size && openfd < 2; i++)\n");
@@ -999,7 +999,7 @@ write_rpc_svc_fg (const char *infile, co
}
else
{
- f_print (fout, "%ssize = getdtablesize();\n", sp);
+ f_print (fout, "%ssize = _rpc_dtablesize();\n", sp);
}
f_print (fout, "%sfor (i = 0; i < size; i++)\n", sp);
More information about the Libc-hacker
mailing list