diff options
Diffstat (limited to 'src/legacy/getdtablesize.c')
-rw-r--r-- | src/legacy/getdtablesize.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/legacy/getdtablesize.c b/src/legacy/getdtablesize.c new file mode 100644 index 00000000..623a6af3 --- /dev/null +++ b/src/legacy/getdtablesize.c @@ -0,0 +1,9 @@ +#include <limits.h> +#include <sys/resource.h> + +int getdtablesize(void) +{ + struct rlimit rl; + getrlimit(RLIMIT_NOFILE, &rl); + return rl.rlim_max < INT_MAX ? rl.rlim_max : INT_MAX; +} |