1GETDTABLESIZE(3) Linux Programmer's Manual GETDTABLESIZE(3)
2
3
4
6 getdtablesize - get file descriptor table size
7
9 #include <unistd.h>
10
11 int getdtablesize(void);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 getdtablesize():
16 Since glibc 2.12:
17 /* Glibc since 2.19: */ _DEFAULT_SOURCE
18 || /* Glibc versions <= 2.19: */ _BSD_SOURCE
19 || ! (_POSIX_C_SOURCE >= 200112L)
20 Before glibc 2.12:
21 _BSD_SOURCE || _XOPEN_SOURCE >= 500
22
24 getdtablesize() returns the maximum number of files a process can have
25 open, one more than the largest possible value for a file descriptor.
26
28 The current limit on the number of open files per process.
29
31 On Linux, getdtablesize() can return any of the errors described for
32 getrlimit(2); see NOTES below.
33
35 For an explanation of the terms used in this section, see
36 attributes(7).
37
38 ┌────────────────┬───────────────┬─────────┐
39 │Interface │ Attribute │ Value │
40 ├────────────────┼───────────────┼─────────┤
41 │getdtablesize() │ Thread safety │ MT-Safe │
42 └────────────────┴───────────────┴─────────┘
44 SVr4, 4.4BSD (the getdtablesize() function first appeared in 4.2BSD).
45 It is not specified in POSIX.1; portable applications should employ
46 sysconf(_SC_OPEN_MAX) instead of this call.
47
49 getdtablesize() is implemented as a libc library function. The glibc
50 version calls getrlimit(2) and returns the current RLIMIT_NOFILE limit,
51 or OPEN_MAX when that fails.
52
54 close(2), dup(2), getrlimit(2), open(2)
55
57 This page is part of release 4.16 of the Linux man-pages project. A
58 description of the project, information about reporting bugs, and the
59 latest version of this page, can be found at
60 https://www.kernel.org/doc/man-pages/.
61
62
63
64Linux 2016-03-15 GETDTABLESIZE(3)