2 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
9 #include <sys/resource.h>
12 /* XXX: _BSD || _XOPEN_SOURCE >= 500 */
13 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
16 #define __LOCAL_OPEN_MAX 256
18 /* Return the maximum number of file descriptors
19 the current process could possibly have. */
20 int getdtablesize (void)
24 /* This should even work if `getrlimit' is not implemented. POSIX.1
25 does not define this function but we will generate a stub which
27 return getrlimit (RLIMIT_NOFILE, &ru) < 0 ? __LOCAL_OPEN_MAX : ru.rlim_cur;
29 libc_hidden_def(getdtablesize)