blob: 7d6d6f29dc78e1556bcd6f893df24b99cb857f4b [file] [log] [blame]
#define _GNU_SOURCE
#include <unistd.h>
#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;
}