OSDN Git Service

ccb7d55eacbedc7a22b338792df5ef22c32306f4
[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 2013-02-05 "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 CONFORMING TO
70 SVr4, 4.4BSD (the
71 .BR getdtablesize ()
72 function first appeared in 4.2BSD).
73 It is not specified in POSIX.1-2001;
74 portable applications should employ
75 .I sysconf(_SC_OPEN_MAX)
76 instead of this call.
77 .SH NOTES
78 .BR getdtablesize ()
79 is implemented as a libc library function.
80 The glibc version calls
81 .BR getrlimit (2)
82 and returns the current
83 .B RLIMIT_NOFILE
84 limit, or
85 .B OPEN_MAX
86 when that fails.
87 The libc4 and libc5 versions return
88 .B OPEN_MAX
89 (set to 256 since Linux 0.98.4).
90 .SH SEE ALSO
91 .BR close (2),
92 .BR dup (2),
93 .BR getrlimit (2),
94 .BR open (2)
95 .SH COLOPHON
96 This page is part of release 3.67 of the Linux
97 .I man-pages
98 project.
99 A description of the project,
100 information about reporting bugs,
101 and the latest version of this page,
102 can be found at
103 \%http://www.kernel.org/doc/man\-pages/.