OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / 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 2014-08-19 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 getdtablesize \- get descriptor table size
30 .SH SYNOPSIS
31 .B #include <unistd.h>
32 .sp
33 .B int getdtablesize(void);
34 .sp
35 .in -4n
36 Feature Test Macro Requirements for glibc (see
37 .BR feature_test_macros (7)):
38 .in
39 .sp
40 .BR getdtablesize ():
41 .ad l
42 .RS 4
43 .PD 0
44 .TP 4
45 Since glibc 2.12:
46 .nf
47 _BSD_SOURCE ||
48     !(_POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600)
49 .TP 4
50 .fi
51 Before glibc 2.12:
52 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
53 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
54 .PD
55 .RE
56 .ad b
57 .SH DESCRIPTION
58 .BR getdtablesize ()
59 returns the maximum number of files a process can have open,
60 one more than the largest possible value for a file descriptor.
61 .SH RETURN VALUE
62 The current limit on the number of open files per process.
63 .SH ERRORS
64 On Linux,
65 .BR getdtablesize ()
66 can return any of the errors described for
67 .BR getrlimit (2);
68 see NOTES below.
69 .SH ATTRIBUTES
70 .SS Multithreading (see pthreads(7))
71 The
72 .BR getdtablesize ()
73 function is thread-safe.
74 .SH CONFORMING TO
75 SVr4, 4.4BSD (the
76 .BR getdtablesize ()
77 function first appeared in 4.2BSD).
78 It is not specified in POSIX.1-2001;
79 portable applications should employ
80 .I sysconf(_SC_OPEN_MAX)
81 instead of this call.
82 .SH NOTES
83 .BR getdtablesize ()
84 is implemented as a libc library function.
85 The glibc version calls
86 .BR getrlimit (2)
87 and returns the current
88 .B RLIMIT_NOFILE
89 limit, or
90 .B OPEN_MAX
91 when that fails.
92 .\" The libc4 and libc5 versions return
93 .\" .B OPEN_MAX
94 .\" (set to 256 since Linux 0.98.4).
95 .SH SEE ALSO
96 .BR close (2),
97 .BR dup (2),
98 .BR getrlimit (2),
99 .BR open (2)
100 .SH COLOPHON
101 This page is part of release 3.79 of the Linux
102 .I man-pages
103 project.
104 A description of the project,
105 information about reporting bugs,
106 and the latest version of this page,
107 can be found at
108 \%http://www.kernel.org/doc/man\-pages/.