summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/appl/bsd/ChangeLog5
-rw-r--r--src/appl/bsd/getdtablesize.c19
2 files changed, 20 insertions, 4 deletions
diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog
index 00f134dc7..9e98a094e 100644
--- a/src/appl/bsd/ChangeLog
+++ b/src/appl/bsd/ChangeLog
@@ -1,3 +1,8 @@
+Mon Nov 7 21:22:00 1994 Theodore Y. Ts'o (tytso@dcl)
+
+ * getdtablesize.c: Use POSIX method of obtaining fd table size,
+ if available.
+
Thu Oct 27 20:07:03 1994 Mark Eichin (eichin@cygnus.com)
* login.c (main): if CSTATUS is missing, don't set c_cc[VSTATUS]
diff --git a/src/appl/bsd/getdtablesize.c b/src/appl/bsd/getdtablesize.c
index 17c4cfd29..244616cc9 100644
--- a/src/appl/bsd/getdtablesize.c
+++ b/src/appl/bsd/getdtablesize.c
@@ -1,8 +1,19 @@
-/* Placed in the Public Domain by Mark Eichin, Cygnus Support 1994 */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <limits.h>
+#ifdef _SC_OPEN_MAX
+int getdtablesize() {
+ return sysconf(_SC_OPEN_MAX);
+}
+#else
#include <sys/resource.h>
+/* Placed in the Public Domain by Mark Eichin, Cygnus Support 1994 */
+
int getdtablesize() {
- struct rlimit rl;
- getrlimit(RLIMIT_NOFILE, &rl);
- return rl.rlim_cur;
+ struct rlimit rl;
+ getrlimit(RLIMIT_NOFILE, &rl);
+ return rl.rlim_cur;
}
+#endif