1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" Modified Sat Jul 24 17:51:42 1993 by Rik Faith (faith@cs.unc.edu)
6 .\" Modified Tue Aug 17 11:42:20 1999 by Ariel Scolnicov (ariels@compugen.co.il)
7 .TH sysconf 3 (date) "Linux man-pages (unreleased)"
9 sysconf \- get configuration information at run time
12 .RI ( libc ", " \-lc )
15 .B #include <unistd.h>
17 .BI "long sysconf(int " "name" );
20 POSIX allows an application to test at compile or run time
21 whether certain options are supported, or what the value is
22 of certain configurable constants or limits.
24 At compile time this is done by including
28 and testing the value of certain macros.
30 At run time, one can ask for numerical values using the present function
32 One can ask for numerical values that may depend
33 on the filesystem in which a file resides using
37 One can ask for string values using
40 The values obtained from these functions are system configuration constants.
41 They do not change during the lifetime of a process.
42 .\" except that sysconf(_SC_OPEN_MAX) may change answer after a call
43 .\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit
45 For options, typically, there is a constant
47 that may be defined in
49 If it is undefined, one should ask at run time.
50 If it is defined to \-1, then the option is not supported.
51 If it is defined to 0, then relevant functions and headers exist,
52 but one has to ask at run time what degree of support is available.
53 If it is defined to a value other than \-1 or 0, then the option is
55 Usually the value (such as 200112L) indicates the year and month
56 of the POSIX revision describing the option.
57 Glibc uses the value 1
58 to indicate support as long as the POSIX revision has not been published yet.
59 .\" and 999 to indicate support for options no longer present in the latest
65 For a list of options, see
68 For variables or limits, typically, there is a constant
76 The constant will not be defined if the limit is unspecified.
77 If the constant is defined, it gives a guaranteed value, and
78 a greater value might actually be supported.
79 If an application wants to take advantage of values which may change
80 between systems, a call to
88 We give the name of the variable, the name of the
90 argument used to inquire about its value,
91 and a short description.
93 First, the POSIX.1 compatible values.
94 .\" [for the moment: only the things that are unconditionally present]
96 .\" .BR AIO_LISTIO_MAX " - " _SC_AIO_LISTIO_MAX
97 .\" (if _POSIX_ASYNCHRONOUS_IO)
98 .\" Maximum number of I/O operations in a single list I/O call.
99 .\" Must not be less than _POSIX_AIO_LISTIO_MAX.
101 .\" .BR AIO_MAX " - " _SC_AIO_MAX
102 .\" (if _POSIX_ASYNCHRONOUS_IO)
103 .\" Maximum number of outstanding asynchronous I/O operations.
104 .\" Must not be less than _POSIX_AIO_MAX.
106 .\" .BR AIO_PRIO_DELTA_MAX " - " _SC_AIO_PRIO_DELTA_MAX
107 .\" (if _POSIX_ASYNCHRONOUS_IO)
108 .\" The maximum amount by which a process can decrease its
109 .\" asynchronous I/O priority level from its own scheduling priority.
110 .\" Must be nonnegative.
112 .BR ARG_MAX " - " _SC_ARG_MAX
113 The maximum length of the arguments to the
116 Must not be less than
120 .BR CHILD_MAX " - " _SC_CHILD_MAX
121 The maximum number of simultaneous processes per user ID.
122 Must not be less than
126 .BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX
127 Maximum length of a hostname, not including the terminating null byte,
130 Must not be less than
131 .B _POSIX_HOST_NAME_MAX
134 .BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX
135 Maximum length of a login name, including the terminating null byte.
136 Must not be less than
137 .B _POSIX_LOGIN_NAME_MAX
140 .BR NGROUPS_MAX " - " _SC_NGROUPS_MAX
141 Maximum number of supplementary group IDs.
143 .BR "" "clock ticks - " _SC_CLK_TCK
144 The number of clock ticks per second.
145 The corresponding variable is obsolete.
146 It was of course called
150 does not give information: it must equal 1000000.)
152 .BR OPEN_MAX " - " _SC_OPEN_MAX
153 The maximum number of files that a process can have open at any time.
154 Must not be less than
158 .BR PAGESIZE " - " _SC_PAGESIZE
159 Size of a page in bytes.
160 Must not be less than 1.
162 .BR PAGE_SIZE " - " _SC_PAGE_SIZE
164 .BR PAGESIZE / _SC_PAGESIZE .
169 are specified in POSIX.)
171 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
172 The number of repeated occurrences of a BRE permitted by
176 Must not be less than
177 .B _POSIX2_RE_DUP_MAX
180 .BR STREAM_MAX " - " _SC_STREAM_MAX
181 The maximum number of streams that a process can have open at any
183 If defined, it has the same value as the standard C macro
185 Must not be less than
189 .BR SYMLOOP_MAX " - " _SC_SYMLOOP_MAX
190 The maximum number of symbolic links seen in a pathname before resolution
193 Must not be less than
194 .B _POSIX_SYMLOOP_MAX
197 .BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX
198 The maximum length of terminal device name,
199 including the terminating null byte.
200 Must not be less than
201 .B _POSIX_TTY_NAME_MAX
204 .BR TZNAME_MAX " - " _SC_TZNAME_MAX
205 The maximum number of bytes in a timezone name.
206 Must not be less than
210 .BR _POSIX_VERSION " - " _SC_VERSION
211 indicates the year and month the POSIX.1 standard was approved in the
216 indicates the Sept. 1990 revision.
217 .SS POSIX.2 variables
218 Next, the POSIX.2 values, giving limits for utilities.
220 .BR BC_BASE_MAX " - " _SC_BC_BASE_MAX
221 indicates the maximum
223 value accepted by the
227 .BR BC_DIM_MAX " - " _SC_BC_DIM_MAX
228 indicates the maximum value of elements permitted in an array by
231 .BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX
232 indicates the maximum
237 .BR BC_STRING_MAX " - " _SC_BC_STRING_MAX
238 indicates the maximum length of a string accepted by
241 .BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX
242 indicates the maximum numbers of weights that can be assigned to an
245 keyword in the locale definition file.
247 .BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX
248 is the maximum number of expressions which can be nested within
252 .BR LINE_MAX " - " _SC_LINE_MAX
253 The maximum length of a utility's input line, either from
254 standard input or from a file.
255 This includes space for a trailing
258 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
259 The maximum number of repeated occurrences of a regular expression when
260 the interval notation
264 .BR POSIX2_VERSION " - " _SC_2_VERSION
265 indicates the version of the POSIX.2 standard in the format of
268 .BR POSIX2_C_DEV " - " _SC_2_C_DEV
269 indicates whether the POSIX.2 C language development facilities are
272 .BR POSIX2_FORT_DEV " - " _SC_2_FORT_DEV
273 indicates whether the POSIX.2 FORTRAN development utilities are
276 .BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN
277 indicates whether the POSIX.2 FORTRAN run-time utilities are supported.
279 .BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF
280 indicates whether the POSIX.2 creation of locales via
284 .BR POSIX2_SW_DEV " - " _SC_2_SW_DEV
285 indicates whether the POSIX.2 software development utilities option is
288 These values also exist, but may not be standard.
290 .BR "" " - " _SC_PHYS_PAGES
291 The number of pages of physical memory.
292 Note that it is possible
293 for the product of this value and the value of
297 .BR "" " - " _SC_AVPHYS_PAGES
298 The number of currently available pages of physical memory.
300 .BR "" " - " _SC_NPROCESSORS_CONF
301 The number of processors configured.
303 .BR get_nprocs_conf (3).
305 .BR "" " - " _SC_NPROCESSORS_ONLN
306 The number of processors currently online (available).
308 .BR get_nprocs_conf (3).
312 is one of the following:
314 On error, \-1 is returned and
316 is set to indicate the error
325 corresponds to a maximum or minimum limit, and that limit is indeterminate,
329 (To distinguish an indeterminate limit from an error, set
331 to zero before the call, and then check whether
333 is nonzero when \-1 is returned.)
337 corresponds to an option,
338 a positive value is returned if the option is supported,
339 and \-1 is returned if the option is not supported.
342 the current value of the option or limit is returned.
343 This value will not be more restrictive than
344 the corresponding value that was described to the application in
348 when the application was compiled.
355 For an explanation of the terms used in this section, see
363 Interface Attribute Value
366 T} Thread safety MT-Safe env
372 POSIX.1-2001, POSIX.1-2008.
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