1GETDTABLESIZE(3)           Linux Programmer's Manual          GETDTABLESIZE(3)
2
3
4

NAME

6       getdtablesize - get file descriptor table size
7

SYNOPSIS

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.20:
17               _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
18           Glibc 2.12 to 2.19:
19               _BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
20           Before glibc 2.12:
21               _BSD_SOURCE || _XOPEN_SOURCE >= 500
22

DESCRIPTION

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

RETURN VALUE

28       The current limit on the number of open files per process.
29

ERRORS

31       On Linux, getdtablesize() can return any of the  errors  described  for
32       getrlimit(2); see NOTES below.
33

ATTRIBUTES

35       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
36       tributes(7).
37
38       ┌────────────────────────────────────────────┬───────────────┬─────────┐
39Interface                                   Attribute     Value   
40       ├────────────────────────────────────────────┼───────────────┼─────────┤
41getdtablesize()                             │ Thread safety │ MT-Safe │
42       └────────────────────────────────────────────┴───────────────┴─────────┘
43

CONFORMING TO

45       SVr4, 4.4BSD (the getdtablesize() function first appeared  in  4.2BSD).
46       It  is  not  specified  in POSIX.1; portable applications should employ
47       sysconf(_SC_OPEN_MAX) instead of this call.
48

NOTES

50       The glibc version of getdtablesize() calls getrlimit(2) and returns the
51       current RLIMIT_NOFILE limit, or OPEN_MAX when that fails.
52

SEE ALSO

54       close(2), dup(2), getrlimit(2), open(2)
55

COLOPHON

57       This  page  is  part of release 5.13 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                             2021-03-22                  GETDTABLESIZE(3)
Impressum