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 at‐
36 tributes(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 The glibc version of getdtablesize() calls getrlimit(2) and returns the
50 current RLIMIT_NOFILE limit, or OPEN_MAX when that fails.
51
53 close(2), dup(2), getrlimit(2), open(2)
54
56 This page is part of release 5.10 of the Linux man-pages project. A
57 description of the project, information about reporting bugs, and the
58 latest version of this page, can be found at
59 https://www.kernel.org/doc/man-pages/.
60
61
62
63Linux 2020-06-09 GETDTABLESIZE(3)