Debian Codegraph @

upstream/debian-trixie/man3/getdtablesize.3

raw
1 '\" t
2 .\" Copyright 1993 Rickard E. Faith ([email protected])
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" Modified 2002-04-15 by Roger Luethi <[email protected]> and aeb
7 .\"
8 .TH getdtablesize 3 2024-06-16 "Linux man-pages 6.9.1"
9 .SH NAME
10 getdtablesize \- get file descriptor table size
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ", " \-lc )
14 .SH SYNOPSIS
15 .nf
16 .B #include <unistd.h>
17 .P
18 .B int getdtablesize(void);
19 .fi
20 .P
21 .RS -4
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .RE
25 .P
26 .BR getdtablesize ():
27 .nf
28 Since glibc 2.20:
29 _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
30 glibc 2.12 to glibc 2.19:
31 _BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
32 Before glibc 2.12:
33 _BSD_SOURCE || _XOPEN_SOURCE >= 500
34 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
35 .fi
36 .SH DESCRIPTION
37 .BR getdtablesize ()
38 returns the maximum number of files a process can have open,
39 one more than the largest possible value for a file descriptor.
40 .SH RETURN VALUE
41 The current limit on the number of open files per process.
42 .SH ERRORS
43 On Linux,
44 .BR getdtablesize ()
45 can return any of the errors described for
46 .BR getrlimit (2);
47 see VERSIONS below.
48 .SH ATTRIBUTES
49 For an explanation of the terms used in this section, see
50 .BR attributes (7).
51 .TS
52 allbox;
53 lbx lb lb
54 l l l.
55 Interface Attribute Value
56 T{
57 .na
58 .nh
59 .BR getdtablesize ()
60 T} Thread safety MT-Safe
61 .TE
62 .SH VERSIONS
63 The glibc version of
64 .BR getdtablesize ()
65 calls
66 .BR getrlimit (2)
67 and returns the current
68 .B RLIMIT_NOFILE
69 limit, or
70 .B OPEN_MAX
71 when that fails.
72 .\" The libc4 and libc5 versions return
73 .\" .B OPEN_MAX
74 .\" (set to 256 since Linux 0.98.4).
75 .P
76 Portable applications should employ
77 .I sysconf(_SC_OPEN_MAX)
78 instead of this call.
79 .SH STANDARDS
80 None.
81 .SH HISTORY
82 SVr4, 4.4BSD
83 (first appeared in 4.2BSD).
84 .SH SEE ALSO
85 .BR close (2),
86 .BR dup (2),
87 .BR getrlimit (2),
88 .BR open (2)