1getdtablesize(3)           Library Functions Manual           getdtablesize(3)
2
3
4

NAME

6       getdtablesize - get file descriptor table size
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <unistd.h>
13
14       int getdtablesize(void);
15
16   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18       getdtablesize():
19           Since glibc 2.20:
20               _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
21           glibc 2.12 to glibc 2.19:
22               _BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
23           Before glibc 2.12:
24               _BSD_SOURCE || _XOPEN_SOURCE >= 500
25

DESCRIPTION

27       getdtablesize()  returns the maximum number of files a process can have
28       open, one more than the largest possible value for a file descriptor.
29

RETURN VALUE

31       The current limit on the number of open files per process.
32

ERRORS

34       On Linux, getdtablesize() can return any of the  errors  described  for
35       getrlimit(2); see NOTES below.
36

ATTRIBUTES

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

VERSIONS

48       The glibc version of getdtablesize() calls getrlimit(2) and returns the
49       current RLIMIT_NOFILE limit, or OPEN_MAX when that fails.
50
51       Portable  applications  should  employ sysconf(_SC_OPEN_MAX) instead of
52       this call.
53

STANDARDS

55       None.
56

HISTORY

58       SVr4, 4.4BSD (first appeared in 4.2BSD).
59

SEE ALSO

61       close(2), dup(2), getrlimit(2), open(2)
62
63
64
65Linux man-pages 6.04              2023-03-30                  getdtablesize(3)
Impressum