]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/getdtablesize.3
_exit.2, bpf.2, cacheflush.2, capget.2, chdir.2, chmod.2, chroot.2, clock_getres...
[thirdparty/man-pages.git] / man3 / getdtablesize.3
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified 2002-04-15 by Roger Luethi <rl@hellgate.ch> and aeb
26 .\"
27 .TH GETDTABLESIZE 3 2016-03-15 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 getdtablesize \- get file descriptor table size
30 .SH SYNOPSIS
31 .B #include <unistd.h>
32 .PP
33 .B int getdtablesize(void);
34 .PP
35 .in -4n
36 Feature Test Macro Requirements for glibc (see
37 .BR feature_test_macros (7)):
38 .in
39 .PP
40 .BR getdtablesize ():
41 .ad l
42 .RS 4
43 .PD 0
44 .TP 4
45 Since glibc 2.12:
46 .nf
47 /* Glibc since 2.19: */ _DEFAULT_SOURCE
48 || /* Glibc versions <= 2.19: */ _BSD_SOURCE
49 || ! (_POSIX_C_SOURCE\ >=\ 200112L)
50 .TP 4
51 .fi
52 Before glibc 2.12:
53 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
54 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
55 .PD
56 .RE
57 .ad b
58 .SH DESCRIPTION
59 .BR getdtablesize ()
60 returns the maximum number of files a process can have open,
61 one more than the largest possible value for a file descriptor.
62 .SH RETURN VALUE
63 The current limit on the number of open files per process.
64 .SH ERRORS
65 On Linux,
66 .BR getdtablesize ()
67 can return any of the errors described for
68 .BR getrlimit (2);
69 see NOTES below.
70 .SH ATTRIBUTES
71 For an explanation of the terms used in this section, see
72 .BR attributes (7).
73 .TS
74 allbox;
75 lb lb lb
76 l l l.
77 Interface Attribute Value
78 T{
79 .BR getdtablesize ()
80 T} Thread safety MT-Safe
81 .TE
82 .SH CONFORMING TO
83 SVr4, 4.4BSD (the
84 .BR getdtablesize ()
85 function first appeared in 4.2BSD).
86 It is not specified in POSIX.1;
87 portable applications should employ
88 .I sysconf(_SC_OPEN_MAX)
89 instead of this call.
90 .SH NOTES
91 .BR getdtablesize ()
92 is implemented as a libc library function.
93 The glibc version calls
94 .BR getrlimit (2)
95 and returns the current
96 .B RLIMIT_NOFILE
97 limit, or
98 .B OPEN_MAX
99 when that fails.
100 .\" The libc4 and libc5 versions return
101 .\" .B OPEN_MAX
102 .\" (set to 256 since Linux 0.98.4).
103 .SH SEE ALSO
104 .BR close (2),
105 .BR dup (2),
106 .BR getrlimit (2),
107 .BR open (2)