]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/sysconf.3
Import of man-pages 1.70
[thirdparty/man-pages.git] / man3 / sysconf.3
1 .\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
23 .\" Modified Sat Jul 24 17:51:42 1993 by Rik Faith (faith@cs.unc.edu)
24 .\" Modified Tue Aug 17 11:42:20 1999 by Ariel Scolnicov (ariels@compugen.co.il)
25 .TH SYSCONF 3 1993-04-18 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 sysconf \- Get configuration information at runtime
28 .SH SYNOPSIS
29 .nf
30 .B #include <unistd.h>
31 .sp
32 .BI "long sysconf(int " "name" );
33 .fi
34 .SH DESCRIPTION
35 POSIX allows an application to test at compile- or run-time
36 whether certain options are supported, or what the value is
37 of certain configurable constants or limits.
38 .LP
39 At compile time this is done by including
40 .I <unistd.h>
41 and/or
42 .I <limits.h>
43 and testing the value of certain macros.
44 .LP
45 At run time, one can ask for numerical values using the present function
46 .BR sysconf ().
47 On can ask for numerical values that may depend
48 on the filesystem a file is in using the calls
49 .BR fpathconf (3)
50 and
51 .BR pathconf (3).
52 One can ask for string values using
53 .BR confstr (3).
54 .LP
55 The values obtained from these functions are system configuration constants.
56 They do not change during the lifetime of a process.
57 .\" except that sysconf(_SC_OPEN_MAX) may change answer after a call
58 .\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit
59 .LP
60 For options, typically, there is a constant
61 .B _POSIX_FOO
62 that may be defined in
63 .IR <unistd.h> .
64 If it is undefined, one should ask at run-time.
65 If it is defined to \-1, then the option is not supported.
66 If it is defined to 0, then relevant functions and headers exist,
67 but one has to ask at runtime what degree of support is available.
68 If it is defined to a value other than \-1 or 0, then the option is
69 supported. Usually the value (such as 200112L) indicates the year and month
70 of the POSIX revision describing the option. Glibc uses the value 1
71 to indicate support as long as the POSIX revision has not been published yet.
72 .\" and 999 to indicate support for options no longer present in the latest
73 .\" standard. (?)
74 The
75 .B sysconf()
76 argument will be
77 .BR _SC_FOO .
78 For a list of options, see
79 .BR posixoptions (7).
80 .LP
81 For variables or limits, typically, there is a constant
82 .BR _FOO ,
83 maybe defined in
84 .IR <limits.h> ,
85 or
86 .BR _POSIX_FOO ,
87 maybe defined in
88 .IR <unistd.h> .
89 The constant will not be defined if the limit is unspecified.
90 If the constant is defined, it gives a guaranteed value, and
91 more might actually be supported.
92 If an application wants to take advantage of values which may change
93 between systems, a call to
94 .B sysconf()
95 can be made.
96 The
97 .B
98 sysconf()
99 argument will be
100 .BR _SC_FOO .
101 .SH "POSIX.1 VARIABLES"
102 We give the name of the variable, the name of the
103 .B sysconf()
104 parameter used to inquire about its value,
105 and a short description.
106 .LP
107 First, the POSIX.1 compatible values.
108 .\" [for the moment: only the things that are unconditionally present]
109 .\" .TP
110 .\" .BR AIO_LISTIO_MAX " - " _SC_AIO_LISTIO_MAX
111 .\" (if _POSIX_ASYNCHRONOUS_IO)
112 .\" Maximum number of I/O operations in a single list I/O call.
113 .\" Must not be less than _POSIX_AIO_LISTIO_MAX.
114 .\" .TP
115 .\" .BR AIO_MAX " - " _SC_AIO_MAX
116 .\" (if _POSIX_ASYNCHRONOUS_IO)
117 .\" Maximum number of outstanding asynchronous I/O operations.
118 .\" Must not be less than _POSIX_AIO_MAX.
119 .\" .TP
120 .\" .BR AIO_PRIO_DELTA_MAX " - " _SC_AIO_PRIO_DELTA_MAX
121 .\" (if _POSIX_ASYNCHRONOUS_IO)
122 .\" The maximum amount by which a process can decrease its
123 .\" asynchronous I/O priority level from its own scheduling priority.
124 .\" Must be nonnegative.
125 .TP
126 .BR ARG_MAX " - " _SC_ARG_MAX
127 The maximum length of the arguments to the
128 .B exec()
129 family of functions.
130 Must not be less than _POSIX_ARG_MAX (4096).
131 .TP
132 .BR CHILD_MAX " - " _SC_CHILD_MAX
133 The max number of simultaneous processes per user id.
134 Must not be less than _POSIX_CHILD_MAX (25).
135 .TP
136 .BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX
137 Max length of a hostname, not including the final NUL, as returned by
138 .BR gethostname (2).
139 Must not be less than _POSIX_HOST_NAME_MAX (255).
140 .TP
141 .BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX
142 Maximum length of a login name, including the final NUL.
143 Must not be less than _POSIX_LOGIN_NAME_MAX (9).
144 .TP
145 .BR "" "clock ticks - " _SC_CLK_TCK
146 The number of clock ticks per second.
147 The corresponding variable is obsolete. It was of course called
148 .BR CLK_TCK .
149 (Note: the macro
150 .B CLOCKS_PER_SEC
151 does not give information: it must equal 1000000.)
152 .TP
153 .BR OPEN_MAX " - " _SC_OPEN_MAX
154 The maximum number of files that a process can have open at any time.
155 Must not be less than _POSIX_OPEN_MAX (20).
156 .TP
157 .BR PAGESIZE " - " _SC_PAGESIZE
158 Size of a page in bytes. Must not be less than 1.
159 (Some systems use PAGE_SIZE instead.)
160 .TP
161 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
162 The number of repeated occurrences of a BRE permitted by
163 .BR regexec (3)
164 and
165 .BR regcomp (3).
166 Must not be less than _POSIX2_RE_DUP_MAX (255).
167 .TP
168 .BR STREAM_MAX " - " _SC_STREAM_MAX
169 The maximum number of streams that a process can have open at any
170 time. If defined, it has the same value as the standard C macro
171 .BR FOPEN_MAX .
172 Must not be less than _POSIX_STREAM_MAX (8).
173 .TP
174 .BR SYMLOOP_MAX
175 The maximum number of symbolic links seen in a pathname before resolution
176 returns ELOOP. Must not be less than _POSIX_SYMLOOP_MAX (8).
177 .TP
178 .BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX
179 The maximum length of terminal device name, including final NUL.
180 Must not be less than _POSIX_TTY_NAME_MAX (9).
181 .TP
182 .BR TZNAME_MAX " - " _SC_TZNAME_MAX
183 The maximum number of bytes in a timezone name.
184 Must not be less than _POSIX_TZNAME_MAX (6).
185 .TP
186 .BR _POSIX_VERSION " - " _SC_VERSION
187 indicates the year and month the POSIX.1 standard was approved in the
188 format
189 .BR YYYYMML ; the
190 value
191 .B 199009L
192 indicates the Sept. 1990 revision.
193 .SH "POSIX.2 VARIABLES"
194 Next, the POSIX.2 values, giving limits for utilities.
195 .TP
196 .BR BC_BASE_MAX " - " _SC_BC_BASE_MAX
197 indicates the maximum
198 .I obase
199 value accepted by the
200 .BR bc (1)
201 utility.
202 .TP
203 .BR BC_DIM_MAX " - " _SC_BC_DIM_MAX
204 indicates the maximum value of elements permitted in an array by
205 .BR bc (1).
206 .TP
207 .BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX
208 indicates the maximum
209 .I scale
210 value allowed by
211 .BR bc (1).
212 .TP
213 .BR BC_STRING_MAX " - " _SC_BC_STRING_MAX
214 indicates the maximum length of a string accepted by
215 .BR bc (1).
216 .TP
217 .BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX
218 indicates the maximum numbers of weights that can be assigned to an
219 entry of the
220 .B LC_COLLATE order
221 keyword in the locale definition file,
222 .TP
223 .BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX
224 is the maximum number of expressions which can be nested within
225 parentheses by
226 .BR expr (1).
227 .TP
228 .BR LINE_MAX " - " _SC_LINE_MAX
229 The maximum length of a utility's input line length, either from
230 standard input or from a file. This includes length for a trailing
231 newline.
232 .TP
233 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
234 The maximum number of repeated occurrences of a regular expression when
235 the interval notation
236 .B \e{m,n\e}
237 is used.
238 .TP
239 .BR POSIX2_VERSION " - " _SC_2_VERSION
240 indicates the version of the POSIX.2 standard in the format of
241 YYYYMML.
242 .TP
243 .BR POSIX2_C_DEV " - " _SC_2_DEV
244 indicates whether the POSIX.2 C language development facilities are
245 supported.
246 .TP
247 .BR POSIX2_FORT_RUN " - " _SC_2_FORT_DEV
248 indicates whether the POSIX.2 FORTRAN development utilities are
249 supported.
250 .TP
251 .BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN
252 indicates whether the POSIX.2 FORTRAN runtime utilities are supported.
253 .TP
254 .BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF
255 indicates whether the POSIX.2 creation of locates via
256 .BR localedef (1)
257 is supported.
258 .TP
259 .BR POSIX2_SW_DEV " - " _SC_2_SW_DEV
260 indicates whether the POSIX.2 software development utilities option is
261 supported.
262 .PP
263 These values also exist, but may not be standard.
264 .TP
265 .BR "" " - " _SC_PHYS_PAGES
266 The number of pages of physical memory. Note that it is possible
267 for the product of this value and the value of
268 .B _SC_PAGE_SIZE
269 to overflow.
270 .TP
271 .BR "" " - " _SC_AVPHYS_PAGES
272 The number of currently available pages of physical memory.
273 .SH "RETURN VALUE"
274 If
275 .I name
276 is invalid, \-1 is returned, and
277 .I errno
278 is set to
279 .BR EINVAL .
280 Otherwise, the value returned is the value of the system resource and
281 .I errno
282 is not changed.
283 In the case of options, a positive value is returned if a queried option
284 is available, and \-1 if it is not.
285 In the case of limits, \-1 means that there is no definite limit.
286 .SH "CONFORMING TO"
287 POSIX.1.
288 .SH BUGS
289 It is difficult to use
290 .B ARG_MAX
291 because it is not specified how much of the argument space for
292 .B exec()
293 is consumed by the user's environment variables.
294 .PP
295 Some returned values may be huge; they are not suitable for allocating
296 memory.
297 .SH "SEE ALSO"
298 .BR bc (1),
299 .BR expr (1),
300 .BR locale (1),
301 .BR fpathconf (3),
302 .BR pathconf (3),
303 .BR posixoptions (7)