1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
3 .\" %%%LICENSE_START(VERBATIM)
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
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)
27 .TH SYSCONF 3 2017-11-26 "GNU" "Linux Programmer's Manual"
29 sysconf \- get configuration information at run time
32 .B #include <unistd.h>
34 .BI "long sysconf(int " "name" );
37 POSIX allows an application to test at compile or run time
38 whether certain options are supported, or what the value is
39 of certain configurable constants or limits.
41 At compile time this is done by including
45 and testing the value of certain macros.
47 At run time, one can ask for numerical values using the present function
49 One can ask for numerical values that may depend
50 on the filesystem in which a file resides using
54 One can ask for string values using
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
60 .\" to setrlimit( ) which changes the RLIMIT_NOFILE soft limit
62 For options, typically, there is a constant
64 that may be defined in
66 If it is undefined, one should ask at run time.
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,
69 but one has to ask at run time what degree of support is available.
70 If it is defined to a value other than \-1 or 0, then the option is
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
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
82 For a list of options, see
85 For variables or limits, typically, there is a constant
93 The constant will not be defined if the limit is unspecified.
94 If the constant is defined, it gives a guaranteed value, and
95 a greater value might actually be supported.
96 If an application wants to take advantage of values which may change
97 between systems, a call to
104 .SS POSIX.1 variables
105 We give the name of the variable, the name of the
107 argument used to inquire about its value,
108 and a short description.
110 First, the POSIX.1 compatible values.
111 .\" [for the moment: only the things that are unconditionally present]
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.
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.
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.
127 .\" Must be nonnegative.
129 .BR ARG_MAX " - " _SC_ARG_MAX
130 The maximum length of the arguments to the
133 Must not be less than
137 .BR CHILD_MAX " - " _SC_CHILD_MAX
138 The maximum number of simultaneous processes per user ID.
139 Must not be less than
143 .BR HOST_NAME_MAX " - " _SC_HOST_NAME_MAX
144 Maximum length of a hostname, not including the terminating null byte,
147 Must not be less than
148 .B _POSIX_HOST_NAME_MAX
151 .BR LOGIN_NAME_MAX " - " _SC_LOGIN_NAME_MAX
152 Maximum length of a login name, including the terminating null byte.
153 Must not be less than
154 .B _POSIX_LOGIN_NAME_MAX
157 .BR NGROUPS_MAX " - " _SC_NGROUPS_MAX
158 Maximum number of supplementary group IDs.
160 .BR "" "clock ticks - " _SC_CLK_TCK
161 The number of clock ticks per second.
162 The corresponding variable is obsolete.
163 It was of course called
167 does not give information: it must equal 1000000.)
169 .BR OPEN_MAX " - " _SC_OPEN_MAX
170 The maximum number of files that a process can have open at any time.
171 Must not be less than
175 .BR PAGESIZE " - " _SC_PAGESIZE
176 Size of a page in bytes.
177 Must not be less than 1.
178 (Some systems use PAGE_SIZE instead.)
180 .BR RE_DUP_MAX " - " _SC_RE_DUP_MAX
181 The number of repeated occurrences of a BRE permitted by
185 Must not be less than
186 .B _POSIX2_RE_DUP_MAX
189 .BR STREAM_MAX " - " _SC_STREAM_MAX
190 The maximum number of streams that a process can have open at any
192 If defined, it has the same value as the standard C macro
194 Must not be less than
198 .BR SYMLOOP_MAX " - " _SC_SYMLOOP_MAX
199 The maximum number of symbolic links seen in a pathname before resolution
202 Must not be less than
203 .B _POSIX_SYMLOOP_MAX
206 .BR TTY_NAME_MAX " - " _SC_TTY_NAME_MAX
207 The maximum length of terminal device name,
208 including the terminating null byte.
209 Must not be less than
210 .B _POSIX_TTY_NAME_MAX
213 .BR TZNAME_MAX " - " _SC_TZNAME_MAX
214 The maximum number of bytes in a timezone name.
215 Must not be less than
219 .BR _POSIX_VERSION " - " _SC_VERSION
220 indicates the year and month the POSIX.1 standard was approved in the
225 indicates the Sept. 1990 revision.
226 .SS POSIX.2 variables
227 Next, the POSIX.2 values, giving limits for utilities.
229 .BR BC_BASE_MAX " - " _SC_BC_BASE_MAX
230 indicates the maximum
232 value accepted by the
236 .BR BC_DIM_MAX " - " _SC_BC_DIM_MAX
237 indicates the maximum value of elements permitted in an array by
240 .BR BC_SCALE_MAX " - " _SC_BC_SCALE_MAX
241 indicates the maximum
246 .BR BC_STRING_MAX " - " _SC_BC_STRING_MAX
247 indicates the maximum length of a string accepted by
250 .BR COLL_WEIGHTS_MAX " - " _SC_COLL_WEIGHTS_MAX
251 indicates the maximum numbers of weights that can be assigned to an
254 keyword in the locale definition file,
256 .BR EXPR_NEST_MAX " - " _SC_EXPR_NEST_MAX
257 is the maximum number of expressions which can be nested within
261 .BR LINE_MAX " - " _SC_LINE_MAX
262 The maximum length of a utility's input line, either from
263 standard input or from a file.
264 This includes space for a trailing
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
273 .BR POSIX2_VERSION " - " _SC_2_VERSION
274 indicates the version of the POSIX.2 standard in the format of
277 .BR POSIX2_C_DEV " - " _SC_2_C_DEV
278 indicates whether the POSIX.2 C language development facilities are
281 .BR POSIX2_FORT_DEV " - " _SC_2_FORT_DEV
282 indicates whether the POSIX.2 FORTRAN development utilities are
285 .BR POSIX2_FORT_RUN " - " _SC_2_FORT_RUN
286 indicates whether the POSIX.2 FORTRAN run-time utilities are supported.
288 .BR _POSIX2_LOCALEDEF " - " _SC_2_LOCALEDEF
289 indicates whether the POSIX.2 creation of locates via
293 .BR POSIX2_SW_DEV " - " _SC_2_SW_DEV
294 indicates whether the POSIX.2 software development utilities option is
297 These values also exist, but may not be standard.
299 .BR "" " - " _SC_PHYS_PAGES
300 The number of pages of physical memory.
301 Note that it is possible
302 for the product of this value and the value of
306 .BR "" " - " _SC_AVPHYS_PAGES
307 The number of currently available pages of physical memory.
309 .BR "" " - " _SC_NPROCESSORS_CONF
310 The number of processors configured.
312 .BR get_nprocs_conf (3).
314 .BR "" " - " _SC_NPROCESSORS_ONLN
315 The number of processors currently online (available).
317 .BR get_nprocs_conf (3).
321 is one of the following:
323 On error, \-1 is returned and
325 is set to indicate the cause of the error
334 corresponds to a maximum or minimum limit, and that limit is indeterminate,
338 (To distinguish an indeterminate limit from an error, set
340 to zero before the call, and then check whether
342 is nonzero when \-1 is returned.)
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.
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
357 when the application was compiled.
364 For an explanation of the terms used in this section, see
370 Interface Attribute Value
373 T} Thread safety MT-Safe env
376 POSIX.1-2001, POSIX.1-2008.
378 It is difficult to use
380 because it is not specified how much of the argument space for
382 is consumed by the user's environment variables.
384 Some returned values may be huge; they are not suitable for allocating