NAME
sysconf - get configuration information at run time SYNOPSIS
#include
long sysconf(int name); DESCRIPTION POSIX allows an application to test at compile or run time whether cer‐ tain options are supported, or what the value is of certain config‐ urable constants or limits. At compile time this is done by including and/or and testing the value of certain macros. At run time, one can ask for numerical values using the present func‐ tion sysconf(). One can ask for numerical values that may depend on the file system a file is in using the calls fpathconf(3) and path‐ conf(3). One can ask for string values using confstr(3). The values obtained from these functions are system configuration con‐ stants. They do not change during the lifetime of a process. For options, typically, there is a constant POSIXFOO that may be defined in . If it is undefined, one should ask at run time. If it is defined to -1, then the option is not supported. If it is defined to 0, then relevant functions and headers exist, but one has to ask at run time what degree of support is available. If it is defined
to a value other than -1 or 0, then the option is supported. Usually the value (such as 200112L) indicates the year and month of the POSIX revision describing the option. Glibc uses the value 1 to indicate support as long as the POSIX revision has not been published yet. The sysconf() argument will be SCFOO. For a list of options, see posixoptions(7). For variables or limits, typically, there is a constant FOO, maybe defined in
, or POSIXFOO, maybe defined in . The constant will not be defined if the limit is unspecified. If the con‐ stant is defined, it gives a guaranteed value, and a greater value might actually be supported. If an application wants to take advantage of values which may change between systems, a call to sysconf() can be made. The sysconf() argument will be SCFOO. POSIX.1 variables We give the name of the variable, the name of the sysconf() argument used to inquire about its value, and a short description. First, the POSIX.1 compatible values. ARGMAX - SCARGMAX The maximum length of the arguments to the exec(3) family of functions. Must not be less than POSIXARGMAX (4096).
CHILDMAX - SCCHILDMAX The maximum number of simultaneous processes per user ID. Must not be less than POSIXCHILDMAX (25).
HOSTNAMEMAX - SCHOSTNAMEMAX Maximum length of a hostname, not including the terminating null byte, as returned by gethostname(2). Must not be less than POSIXHOSTNAMEMAX (255).
LOGINNAMEMAX - SCLOGINNAMEMAX Maximum length of a login name, including the terminating null byte. Must not be less than POSIXLOGINNAMEMAX (9).
clock ticks - SCCLKTCK The number of clock ticks per second. The corresponding vari‐ able is obsolete. It was of course called CLKTCK. (Note: the macro CLOCKSPERSEC does not give information: it must equal 1000000.)
OPENMAX - SCOPENMAX The maximum number of files that a process can have open at any time. Must not be less than POSIXOPENMAX (20).
PAGESIZE - SCPAGESIZE Size of a page in bytes. Must not be less than 1. (Some sys‐ tems use PAGESIZE instead.)
REDUPMAX - SCREDUPMAX The number of repeated occurrences of a BRE permitted by regexec(3) and regcomp(3). Must not be less than POSIX2REDUPMAX (255).
STREAMMAX - SCSTREAMMAX The maximum number of streams that a process can have open at any time. If defined, it has the same value as the standard C macro FOPENMAX. Must not be less than POSIXSTREAMMAX (8).
SYMLOOPMAX - SCSYMLOOPMAX The maximum number of symbolic links seen in a pathname before resolution returns ELOOP. Must not be less than POSIXSYM‐ LOOPMAX (8).
TTYNAMEMAX - SCTTYNAMEMAX The maximum length of terminal device name, including the termi‐ nating null byte. Must not be less than POSIXTTYNAMEMAX (9).
TZNAMEMAX - SCTZNAMEMAX The maximum number of bytes in a timezone name. Must not be less than POSIXTZNAMEMAX (6).
POSIXVERSION - SCVERSION indicates the year and month the POSIX.1 standard was approved in the format YYYYMML; the value 199009L indicates the Sept. 1990 revision. POSIX.2 variables Next, the POSIX.2 values, giving limits for utilities.
BCBASEMAX - SCBCBASEMAX indicates the maximum obase value accepted by the bc(1) utility.
BCDIMMAX - SCBCDIMMAX indicates the maximum value of elements permitted in an array by bc(1).
BCSCALEMAX - SCBCSCALEMAX indicates the maximum scale value allowed by bc(1).
BCSTRINGMAX - SCBCSTRINGMAX indicates the maximum length of a string accepted by bc(1).
COLLWEIGHTSMAX - SCCOLLWEIGHTSMAX indicates the maximum numbers of weights that can be assigned to an entry of the LCCOLLATE order keyword in the locale defini‐ tion file,
EXPRNESTMAX - SCEXPRNESTMAX is the maximum number of expressions which can be nested within parentheses by expr(1).
LINEMAX - SCLINEMAX The maximum length of a utility's input line, either from stan‐ dard input or from a file. This includes space for a trailing newline.
REDUPMAX - SCREDUPMAX The maximum number of repeated occurrences of a regular expres‐ sion when the interval notation \{m,n\} is used.
POSIX2VERSION - SC2VERSION indicates the version of the POSIX.2 standard in the format of YYYYMML.
POSIX2CDEV - SC2CDEV indicates whether the POSIX.2 C language development facilities are supported.
POSIX2FORTDEV - SC2FORTDEV indicates whether the POSIX.2 FORTRAN development utilities are supported.
POSIX2FORTRUN - SC2FORTRUN
indicates whether the POSIX.2 FORTRAN run-time utilities are supported.
POSIX2LOCALEDEF - SC2LOCALEDEF indicates whether the POSIX.2 creation of locates via localedef(1) is supported.
POSIX2SWDEV - SC2SWDEV indicates whether the POSIX.2 software development utilities option is supported. These values also exist, but may not be standard.
- SCPHYSPAGES The number of pages of physical memory. Note that it is possi‐ ble for the product of this value and the value of SCPAGESIZE to overflow.
- SCAVPHYSPAGES The number of currently available pages of physical memory.
- SCNPROCESSORSCONF The number of processors configured.
- SCNPROCESSORSONLN The number of processors currently online (available). RETURN VALUE
If name is invalid, -1 is returned, and errno is set to EINVAL. Other‐ wise, the value returned is the value of the system resource and errno is not changed. In the case of options, a positive value is returned
if a queried option is available, and -1 if it is not. In the case of
limits, -1 means that there is no definite limit. CONFORMING TO
POSIX.1-2001. BUGS It is difficult to use ARGMAX because it is not specified how much of the argument space for exec(3) is consumed by the user's environment variables. Some returned values may be huge; they are not suitable for allocating memory. SEE ALSO bc(1), expr(1), getconf(1), locale(1), fpathconf(3), pathconf(3), posixoptions(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2013-02-12 SYSCONF(3)