]>
Commit | Line | Data |
---|---|---|
bf5a7247 | 1 | .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) |
fea681da | 2 | .\" |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
c08df37a | 24 | .\" |
fea681da MK |
25 | .\" Modified Sat Jul 24 17:51:42 1993 by Rik Faith (faith@cs.unc.edu) |
26 | .\" Modified Tue Aug 17 11:42:20 1999 by Ariel Scolnicov (ariels@compugen.co.il) | |
1c6f59c2 | 27 | .TH SYSCONF 3 2017-11-26 "GNU" "Linux Programmer's Manual" |
fea681da | 28 | .SH NAME |
72c90260 | 29 | sysconf \- get configuration information at run time |
fea681da MK |
30 | .SH SYNOPSIS |
31 | .nf | |
32 | .B #include <unistd.h> | |
68e4db0a | 33 | .PP |
fea681da MK |
34 | .BI "long sysconf(int " "name" ); |
35 | .fi | |
36 | .SH DESCRIPTION | |
cf50118f | 37 | POSIX allows an application to test at compile or run time |
fea681da MK |
38 | whether certain options are supported, or what the value is |
39 | of certain configurable constants or limits. | |
dd3568a1 | 40 | .PP |
fea681da MK |
41 | At compile time this is done by including |
42 | .I <unistd.h> | |
43 | and/or | |
44 | .I <limits.h> | |
45 | and testing the value of certain macros. | |
dd3568a1 | 46 | .PP |
fea681da MK |
47 | At run time, one can ask for numerical values using the present function |
48 | .BR sysconf (). | |
7d0db56e | 49 | One can ask for numerical values that may depend |
386732aa | 50 | on the filesystem in which a file resides using |
fea681da MK |
51 | .BR fpathconf (3) |
52 | and | |
53 | .BR pathconf (3). | |
54 | One can ask for string values using | |
55 | .BR confstr (3). | |
dd3568a1 | 56 | .PP |
fea681da MK |
57 | The values obtained from these functions are system configuration constants. |
58 | They do not change during the lifetime of a process. | |
59 | .\" except that sysconf(_SC_OPEN_MAX) may change answer after a call | |
0425de01 | 60 | .\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit |
dd3568a1 | 61 | .PP |
fea681da MK |
62 | For options, typically, there is a constant |
63 | .B _POSIX_FOO | |
64 | that may be defined in | |
65 | .IR <unistd.h> . | |
cf50118f | 66 | If it is undefined, one should ask at run time. |
fea681da MK |
67 | If it is defined to \-1, then the option is not supported. |
68 | If it is defined to 0, then relevant functions and headers exist, | |
72c90260 | 69 | but one has to ask at run time what degree of support is available. |
fea681da | 70 | If it is defined to a value other than \-1 or 0, then the option is |
c13182ef MK |
71 | supported. |
72 | Usually the value (such as 200112L) indicates the year and month | |
73 | of the POSIX revision describing the option. | |
74 | Glibc uses the value 1 | |
fea681da MK |
75 | to indicate support as long as the POSIX revision has not been published yet. |
76 | .\" and 999 to indicate support for options no longer present in the latest | |
77 | .\" standard. (?) | |
78 | The | |
63aa9df0 | 79 | .BR sysconf () |
fea681da MK |
80 | argument will be |
81 | .BR _SC_FOO . | |
82 | For a list of options, see | |
83 | .BR posixoptions (7). | |
dd3568a1 | 84 | .PP |
fea681da MK |
85 | For variables or limits, typically, there is a constant |
86 | .BR _FOO , | |
87 | maybe defined in | |
88 | .IR <limits.h> , | |
89 | or | |
90 | .BR _POSIX_FOO , | |
91 | maybe defined in | |
92 | .IR <unistd.h> . | |
93 | The constant will not be defined if the limit is unspecified. | |
94 | If the constant is defined, it gives a guaranteed value, and | |
5c4045cb | 95 | a greater value might actually be supported. |
fea681da MK |
96 | If an application wants to take advantage of values which may change |
97 | between systems, a call to | |
63aa9df0 | 98 | .BR sysconf () |
fea681da | 99 | can be made. |
c13182ef | 100 | The |
4a225b7a | 101 | .BR sysconf () |
fea681da MK |
102 | argument will be |
103 | .BR _SC_FOO . | |
73d8cece | 104 | .SS POSIX.1 variables |
fea681da | 105 | We give the name of the variable, the name of the |
63aa9df0 | 106 | .BR sysconf () |
c4bb193f | 107 | argument used to inquire about its value, |
fea681da | 108 | and a short description. |
dd3568a1 | 109 | .PP |
fea681da MK |
110 | First, the POSIX.1 compatible values. |
111 | .\" [for the moment: only the things that are unconditionally present] | |
112 | .\" .TP | |
113 | .\" .BR AIO_LISTIO_MAX " - " _SC_AIO_LISTIO_MAX | |
114 | .\" (if _POSIX_ASYNCHRONOUS_IO) | |
115 | .\" Maximum number of I/O operations in a single list I/O call. | |
116 | .\" Must not be less than _POSIX_AIO_LISTIO_MAX. | |
117 | .\" .TP | |
118 | .\" .BR AIO_MAX " - " _SC_AIO_MAX | |
119 | .\" (if _POSIX_ASYNCHRONOUS_IO) | |
120 | .\" Maximum number of outstanding asynchronous I/O operations. | |
121 | .\" Must not be less than _POSIX_AIO_MAX. | |
122 | .\" .TP | |
123 | .\" .BR AIO_PRIO_DELTA_MAX " - " _SC_AIO_PRIO_DELTA_MAX | |
124 | .\" (if _POSIX_ASYNCHRONOUS_IO) | |
125 | .\" The maximum amount by which a process can decrease its | |
126 | .\" asynchronous I/O priority level from its own scheduling priority. | |
2fda57bd | 127 | .\" Must be nonnegative. |
fea681da MK |
128 | .TP |
129 | .BR ARG_MAX " - " _SC_ARG_MAX | |
130 | The maximum length of the arguments to the | |
3a72373c | 131 | .BR exec (3) |
fea681da | 132 | family of functions. |
8c4f34f8 MK |
133 | Must not be less than |
134 | .B _POSIX_ARG_MAX | |
135 | (4096). | |
fea681da MK |
136 | .TP |
137 | .BR CHILD_MAX " - " _SC_CHILD_MAX | |
82e07898 | 138 | The maximum number of simultaneous processes per user ID. |
8c4f34f8 MK |
139 | Must not be less than |
140 | .B _POSIX_CHILD_MAX | |
141 | (25). | |
fea681da MK |
142 | .TP |
143 | .BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX | |
82e07898 | 144 | Maximum length of a hostname, not including the terminating null byte, |
28d88c17 | 145 | as returned by |
fea681da | 146 | .BR gethostname (2). |
8c4f34f8 MK |
147 | Must not be less than |
148 | .B _POSIX_HOST_NAME_MAX | |
149 | (255). | |
fea681da MK |
150 | .TP |
151 | .BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX | |
28d88c17 | 152 | Maximum length of a login name, including the terminating null byte. |
8c4f34f8 MK |
153 | Must not be less than |
154 | .B _POSIX_LOGIN_NAME_MAX | |
155 | (9). | |
fea681da | 156 | .TP |
4d300f4a JT |
157 | .BR NGROUPS_MAX " - " _SC_NGROUPS_MAX |
158 | Maximum number of supplementary group IDs. | |
159 | .TP | |
fea681da MK |
160 | .BR "" "clock ticks - " _SC_CLK_TCK |
161 | The number of clock ticks per second. | |
c13182ef MK |
162 | The corresponding variable is obsolete. |
163 | It was of course called | |
fea681da MK |
164 | .BR CLK_TCK . |
165 | (Note: the macro | |
166 | .B CLOCKS_PER_SEC | |
167 | does not give information: it must equal 1000000.) | |
168 | .TP | |
169 | .BR OPEN_MAX " - " _SC_OPEN_MAX | |
170 | The maximum number of files that a process can have open at any time. | |
8c4f34f8 MK |
171 | Must not be less than |
172 | .B _POSIX_OPEN_MAX | |
173 | (20). | |
fea681da MK |
174 | .TP |
175 | .BR PAGESIZE " - " _SC_PAGESIZE | |
c13182ef MK |
176 | Size of a page in bytes. |
177 | Must not be less than 1. | |
fea681da MK |
178 | (Some systems use PAGE_SIZE instead.) |
179 | .TP | |
180 | .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX | |
181 | The number of repeated occurrences of a BRE permitted by | |
182 | .BR regexec (3) | |
183 | and | |
184 | .BR regcomp (3). | |
8c4f34f8 MK |
185 | Must not be less than |
186 | .B _POSIX2_RE_DUP_MAX | |
187 | (255). | |
fea681da MK |
188 | .TP |
189 | .BR STREAM_MAX " - " _SC_STREAM_MAX | |
190 | The maximum number of streams that a process can have open at any | |
c13182ef MK |
191 | time. |
192 | If defined, it has the same value as the standard C macro | |
fea681da | 193 | .BR FOPEN_MAX . |
8c4f34f8 MK |
194 | Must not be less than |
195 | .B _POSIX_STREAM_MAX | |
196 | (8). | |
fea681da | 197 | .TP |
3dd1c10f | 198 | .BR SYMLOOP_MAX " - " _SC_SYMLOOP_MAX |
fea681da | 199 | The maximum number of symbolic links seen in a pathname before resolution |
097585ed MK |
200 | returns |
201 | .BR ELOOP . | |
8c4f34f8 MK |
202 | Must not be less than |
203 | .B _POSIX_SYMLOOP_MAX | |
204 | (8). | |
fea681da MK |
205 | .TP |
206 | .BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX | |
c13182ef | 207 | The maximum length of terminal device name, |
28d88c17 | 208 | including the terminating null byte. |
8c4f34f8 | 209 | Must not be less than |
0daa9e92 | 210 | .B _POSIX_TTY_NAME_MAX |
8c4f34f8 | 211 | (9). |
fea681da MK |
212 | .TP |
213 | .BR TZNAME_MAX " - " _SC_TZNAME_MAX | |
214 | The maximum number of bytes in a timezone name. | |
8c4f34f8 | 215 | Must not be less than |
0daa9e92 | 216 | .B _POSIX_TZNAME_MAX |
8c4f34f8 | 217 | (6). |
fea681da MK |
218 | .TP |
219 | .BR _POSIX_VERSION " - " _SC_VERSION | |
220 | indicates the year and month the POSIX.1 standard was approved in the | |
221 | format | |
1368e847 MK |
222 | .BR YYYYMML ; |
223 | the value | |
fea681da MK |
224 | .B 199009L |
225 | indicates the Sept. 1990 revision. | |
73d8cece | 226 | .SS POSIX.2 variables |
fea681da MK |
227 | Next, the POSIX.2 values, giving limits for utilities. |
228 | .TP | |
229 | .BR BC_BASE_MAX " - " _SC_BC_BASE_MAX | |
230 | indicates the maximum | |
231 | .I obase | |
232 | value accepted by the | |
233 | .BR bc (1) | |
234 | utility. | |
235 | .TP | |
236 | .BR BC_DIM_MAX " - " _SC_BC_DIM_MAX | |
237 | indicates the maximum value of elements permitted in an array by | |
238 | .BR bc (1). | |
239 | .TP | |
240 | .BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX | |
241 | indicates the maximum | |
242 | .I scale | |
243 | value allowed by | |
244 | .BR bc (1). | |
245 | .TP | |
246 | .BR BC_STRING_MAX " - " _SC_BC_STRING_MAX | |
247 | indicates the maximum length of a string accepted by | |
248 | .BR bc (1). | |
249 | .TP | |
250 | .BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX | |
251 | indicates the maximum numbers of weights that can be assigned to an | |
252 | entry of the | |
253 | .B LC_COLLATE order | |
254 | keyword in the locale definition file, | |
255 | .TP | |
256 | .BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX | |
257 | is the maximum number of expressions which can be nested within | |
258 | parentheses by | |
259 | .BR expr (1). | |
260 | .TP | |
261 | .BR LINE_MAX " - " _SC_LINE_MAX | |
4a5d77d4 | 262 | The maximum length of a utility's input line, either from |
c13182ef | 263 | standard input or from a file. |
fa233003 | 264 | This includes space for a trailing |
fea681da MK |
265 | newline. |
266 | .TP | |
267 | .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX | |
268 | The maximum number of repeated occurrences of a regular expression when | |
269 | the interval notation | |
31a6818e | 270 | .B \e{m,n\e} |
fea681da MK |
271 | is used. |
272 | .TP | |
273 | .BR POSIX2_VERSION " - " _SC_2_VERSION | |
274 | indicates the version of the POSIX.2 standard in the format of | |
275 | YYYYMML. | |
276 | .TP | |
961abb97 | 277 | .BR POSIX2_C_DEV " - " _SC_2_C_DEV |
fea681da MK |
278 | indicates whether the POSIX.2 C language development facilities are |
279 | supported. | |
280 | .TP | |
50a0922f | 281 | .BR POSIX2_FORT_DEV " - " _SC_2_FORT_DEV |
fea681da MK |
282 | indicates whether the POSIX.2 FORTRAN development utilities are |
283 | supported. | |
284 | .TP | |
285 | .BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN | |
72c90260 | 286 | indicates whether the POSIX.2 FORTRAN run-time utilities are supported. |
fea681da MK |
287 | .TP |
288 | .BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF | |
289 | indicates whether the POSIX.2 creation of locates via | |
290 | .BR localedef (1) | |
291 | is supported. | |
292 | .TP | |
293 | .BR POSIX2_SW_DEV " - " _SC_2_SW_DEV | |
294 | indicates whether the POSIX.2 software development utilities option is | |
295 | supported. | |
296 | .PP | |
297 | These values also exist, but may not be standard. | |
298 | .TP | |
299 | .BR "" " - " _SC_PHYS_PAGES | |
c13182ef MK |
300 | The number of pages of physical memory. |
301 | Note that it is possible | |
fea681da | 302 | for the product of this value and the value of |
c9764208 | 303 | .B _SC_PAGESIZE |
fea681da MK |
304 | to overflow. |
305 | .TP | |
306 | .BR "" " - " _SC_AVPHYS_PAGES | |
307 | The number of currently available pages of physical memory. | |
a19d984e MK |
308 | .TP |
309 | .BR "" " - " _SC_NPROCESSORS_CONF | |
310 | The number of processors configured. | |
39a6b7e8 MK |
311 | See also |
312 | .BR get_nprocs_conf (3). | |
a19d984e MK |
313 | .TP |
314 | .BR "" " - " _SC_NPROCESSORS_ONLN | |
315 | The number of processors currently online (available). | |
39a6b7e8 MK |
316 | See also |
317 | .BR get_nprocs_conf (3). | |
47297adb | 318 | .SH RETURN VALUE |
480ef6d9 MK |
319 | The return value of |
320 | .BR sysconf () | |
321 | is one of the following: | |
322 | .IP * 3 | |
323 | On error, \-1 is returned and | |
324 | .I errno | |
325 | is set to indicate the cause of the error | |
326 | (for example, | |
327 | .BR EINVAL , | |
328 | indicating that | |
329 | .I name | |
330 | is invalid). | |
331 | .IP * | |
fea681da MK |
332 | If |
333 | .I name | |
480ef6d9 MK |
334 | corresponds to a maximum or minimum limit, and that limit is indeterminate, |
335 | \-1 is returned and | |
fea681da MK |
336 | .I errno |
337 | is not changed. | |
480ef6d9 MK |
338 | (To distinguish an indeterminate limit from an error, set |
339 | .I errno | |
340 | to zero before the call, and then check whether | |
341 | .I errno | |
342 | is nonzero when \-1 is returned.) | |
343 | .IP * | |
344 | If | |
345 | .I name | |
346 | corresponds to an option, | |
347 | a positive value is returned if the option is supported, | |
348 | and \-1 is returned if the option is not supported. | |
349 | .IP * | |
350 | Otherwise, | |
351 | the current value of the option or limit is returned. | |
352 | This value will not be more restrictive than | |
353 | the corresponding value that was described to the application in | |
354 | .I <unistd.h> | |
355 | or | |
356 | .I <limits.h> | |
357 | when the application was compiled. | |
646896d3 MK |
358 | .SH ERRORS |
359 | .TP | |
360 | .B EINVAL | |
361 | .I name | |
362 | is invalid. | |
dfcbc01f ZL |
363 | .SH ATTRIBUTES |
364 | For an explanation of the terms used in this section, see | |
365 | .BR attributes (7). | |
366 | .TS | |
367 | allbox; | |
368 | lb lb lb | |
369 | l l l. | |
370 | Interface Attribute Value | |
371 | T{ | |
372 | .BR sysconf () | |
373 | T} Thread safety MT-Safe env | |
374 | .TE | |
47297adb | 375 | .SH CONFORMING TO |
b9ced44f | 376 | POSIX.1-2001, POSIX.1-2008. |
fea681da MK |
377 | .SH BUGS |
378 | It is difficult to use | |
379 | .B ARG_MAX | |
380 | because it is not specified how much of the argument space for | |
3a72373c | 381 | .BR exec (3) |
fea681da MK |
382 | is consumed by the user's environment variables. |
383 | .PP | |
384 | Some returned values may be huge; they are not suitable for allocating | |
385 | memory. | |
47297adb | 386 | .SH SEE ALSO |
fea681da MK |
387 | .BR bc (1), |
388 | .BR expr (1), | |
ceff5191 | 389 | .BR getconf (1), |
fea681da | 390 | .BR locale (1), |
e812955a | 391 | .BR confstr (3), |
fea681da MK |
392 | .BR fpathconf (3), |
393 | .BR pathconf (3), | |
394 | .BR posixoptions (7) |