2 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
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)
8 .TH sysconf 3 (date) "Linux man-pages (unreleased)"
10 sysconf \- get configuration information at run time
13 .RI ( libc ", " \-lc )
16 .B #include <unistd.h>
18 .BI "long sysconf(int " "name" );
21 POSIX allows an application to test at compile or run time
22 whether certain options are supported, or what the value is
23 of certain configurable constants or limits.
25 At compile time this is done by including
29 and testing the value of certain macros.
31 At run time, one can ask for numerical values using the present function
33 One can ask for numerical values that may depend
34 on the filesystem in which a file resides using
38 One can ask for string values using
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
44 .\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit
46 For options, typically, there is a constant
48 that may be defined in
50 If it is undefined, one should ask at run time.
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,
53 but one has to ask at run time what degree of support is available.
54 If it is defined to a value other than \-1 or 0, then the option is
56 Usually the value (such as 200112L) indicates the year and month
57 of the POSIX revision describing the option.
58 glibc uses the value 1
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
66 For a list of options, see
69 For variables or limits, typically, there is a constant
77 The constant will not be defined if the limit is unspecified.
78 If the constant is defined, it gives a guaranteed value, and
79 a greater value might actually be supported.
80 If an application wants to take advantage of values which may change
81 between systems, a call to
89 We give the name of the variable, the name of the
91 argument used to inquire about its value,
92 and a short description.
94 First, the POSIX.1 compatible values.
95 .\" [for the moment: only the things that are unconditionally present]
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.
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.
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.
111 .\" Must be nonnegative.
113 .BR ARG_MAX " - " _SC_ARG_MAX
114 The maximum length of the arguments to the
117 Must not be less than
121 .BR CHILD_MAX " - " _SC_CHILD_MAX
122 The maximum number of simultaneous processes per user ID.
123 Must not be less than
127 .BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX
128 Maximum length of a hostname, not including the terminating null byte,
131 Must not be less than
132 .B _POSIX_HOST_NAME_MAX
135 .BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX
136 Maximum length of a login name, including the terminating null byte.
137 Must not be less than
138 .B _POSIX_LOGIN_NAME_MAX
141 .BR NGROUPS_MAX " - " _SC_NGROUPS_MAX
142 Maximum number of supplementary group IDs.
144 .BR "" "clock ticks - " _SC_CLK_TCK
145 The number of clock ticks per second.
146 The corresponding variable is obsolete.
147 It was of course called
151 does not give information: it must equal 1000000.)
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
159 .BR PAGESIZE " - " _SC_PAGESIZE
160 Size of a page in bytes.
161 Must not be less than 1.
163 .BR PAGE_SIZE " - " _SC_PAGE_SIZE
165 .BR PAGESIZE / _SC_PAGESIZE .
170 are specified in POSIX.)
172 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
173 The number of repeated occurrences of a BRE permitted by
177 Must not be less than
178 .B _POSIX2_RE_DUP_MAX
181 .BR STREAM_MAX " - " _SC_STREAM_MAX
182 The maximum number of streams that a process can have open at any
184 If defined, it has the same value as the standard C macro
186 Must not be less than
190 .BR SYMLOOP_MAX " - " _SC_SYMLOOP_MAX
191 The maximum number of symbolic links seen in a pathname before resolution
194 Must not be less than
195 .B _POSIX_SYMLOOP_MAX
198 .BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX
199 The maximum length of terminal device name,
200 including the terminating null byte.
201 Must not be less than
202 .B _POSIX_TTY_NAME_MAX
205 .BR TZNAME_MAX " - " _SC_TZNAME_MAX
206 The maximum number of bytes in a timezone name.
207 Must not be less than
211 .BR _POSIX_VERSION " - " _SC_VERSION
212 indicates the year and month the POSIX.1 standard was approved in the
217 indicates the Sept. 1990 revision.
218 .SS POSIX.2 variables
219 Next, the POSIX.2 values, giving limits for utilities.
221 .BR BC_BASE_MAX " - " _SC_BC_BASE_MAX
222 indicates the maximum
224 value accepted by the
228 .BR BC_DIM_MAX " - " _SC_BC_DIM_MAX
229 indicates the maximum value of elements permitted in an array by
232 .BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX
233 indicates the maximum
238 .BR BC_STRING_MAX " - " _SC_BC_STRING_MAX
239 indicates the maximum length of a string accepted by
242 .BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX
243 indicates the maximum numbers of weights that can be assigned to an
246 keyword in the locale definition file.
248 .BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX
249 is the maximum number of expressions which can be nested within
253 .BR LINE_MAX " - " _SC_LINE_MAX
254 The maximum length of a utility's input line, either from
255 standard input or from a file.
256 This includes space for a trailing
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
265 .BR POSIX2_VERSION " - " _SC_2_VERSION
266 indicates the version of the POSIX.2 standard in the format of
269 .BR POSIX2_C_DEV " - " _SC_2_C_DEV
270 indicates whether the POSIX.2 C language development facilities are
273 .BR POSIX2_FORT_DEV " - " _SC_2_FORT_DEV
274 indicates whether the POSIX.2 FORTRAN development utilities are
277 .BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN
278 indicates whether the POSIX.2 FORTRAN run-time utilities are supported.
280 .BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF
281 indicates whether the POSIX.2 creation of locales via
285 .BR POSIX2_SW_DEV " - " _SC_2_SW_DEV
286 indicates whether the POSIX.2 software development utilities option is
289 These values also exist, but may not be standard.
291 .BR "" " - " _SC_PHYS_PAGES
292 The number of pages of physical memory.
293 Note that it is possible
294 for the product of this value and the value of
298 .BR "" " - " _SC_AVPHYS_PAGES
299 The number of currently available pages of physical memory.
301 .BR "" " - " _SC_NPROCESSORS_CONF
302 The number of processors configured.
304 .BR get_nprocs_conf (3).
306 .BR "" " - " _SC_NPROCESSORS_ONLN
307 The number of processors currently online (available).
309 .BR get_nprocs_conf (3).
313 is one of the following:
315 On error, \-1 is returned and
317 is set to indicate the error
326 corresponds to a maximum or minimum limit, and that limit is indeterminate,
330 (To distinguish an indeterminate limit from an error, set
332 to zero before the call, and then check whether
334 is nonzero when \-1 is returned.)
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.
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
349 when the application was compiled.
356 For an explanation of the terms used in this section, see
362 Interface Attribute Value
367 T} Thread safety MT-Safe env
374 It is difficult to use
376 because it is not specified how much of the argument space for
378 is consumed by the user's environment variables.
380 Some returned values may be huge; they are not suitable for allocating