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