#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#include <limits.h>#ifdef _SC_OPEN_MAXintgetdtablesize() {returnsysconf(_SC_OPEN_MAX);}#else#include <sys/resource.h>/* Placed in the Public Domain by Mark Eichin, Cygnus Support 1994 */intgetdtablesize() {struct rlimit rl;getrlimit(RLIMIT_NOFILE, &rl);return rl.rlim_cur;}#endif