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