poll.2: Remove <signal.h>
[man-pages.git] / man3 / getdtablesize.3
blobf6b69a49df5b9989357cbffa938b28aae7693c35
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 2021-03-22 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 getdtablesize \- get file descriptor table size
30 .SH SYNOPSIS
31 .nf
32 .B #include <unistd.h>
33 .PP
34 .B int getdtablesize(void);
35 .fi
36 .PP
37 .RS -4
38 Feature Test Macro Requirements for glibc (see
39 .BR feature_test_macros (7)):
40 .RE
41 .PP
42 .BR getdtablesize ():
43 .nf
44     Since glibc 2.20:
45         _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
46     Glibc 2.12 to 2.19:
47         _BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
48     Before glibc 2.12:
49         _BSD_SOURCE || _XOPEN_SOURCE >= 500
50 .\"        || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
51 .fi
52 .SH DESCRIPTION
53 .BR getdtablesize ()
54 returns the maximum number of files a process can have open,
55 one more than the largest possible value for a file descriptor.
56 .SH RETURN VALUE
57 The current limit on the number of open files per process.
58 .SH ERRORS
59 On Linux,
60 .BR getdtablesize ()
61 can return any of the errors described for
62 .BR getrlimit (2);
63 see NOTES below.
64 .SH ATTRIBUTES
65 For an explanation of the terms used in this section, see
66 .BR attributes (7).
67 .ad l
68 .nh
69 .TS
70 allbox;
71 lbx lb lb
72 l l l.
73 Interface       Attribute       Value
75 .BR getdtablesize ()
76 T}      Thread safety   MT-Safe
77 .TE
78 .hy
79 .ad
80 .sp 1
81 .SH CONFORMING TO
82 SVr4, 4.4BSD (the
83 .BR getdtablesize ()
84 function first appeared in 4.2BSD).
85 It is not specified in POSIX.1;
86 portable applications should employ
87 .I sysconf(_SC_OPEN_MAX)
88 instead of this call.
89 .SH NOTES
90 The glibc version of
91 .BR getdtablesize ()
92 calls
93 .BR getrlimit (2)
94 and returns the current
95 .B RLIMIT_NOFILE
96 limit, or
97 .B OPEN_MAX
98 when that fails.
99 .\" The libc4 and libc5 versions return
100 .\" .B OPEN_MAX
101 .\" (set to 256 since Linux 0.98.4).
102 .SH SEE ALSO
103 .BR close (2),
104 .BR dup (2),
105 .BR getrlimit (2),
106 .BR open (2)