SYSCONF(2)
NAME
sysconf − get configurable system variables
SYNOPSIS
#include <unistd.h>
long sysconf(name)
int name;
DESCRIPTION
The sysconf function enables applications to determine the current value of a configurable limit or variable.
The name argument represents the system variable being queried.
The following table lists the configuration variables whose values can be determined by calling sysconf, and for each variable, the associated value of the name argument and function return:
| Variable | Value of name | Value Returned |
| ARG_MAX | _SC_ARG_MAX | Maximum length of the arguments for exec(2) in bytes, including environment data |
| CHILD_MAX | _SC_CHILD_MAX | Maximum number of simultaneous processes per user ID |
| CLK_TCK | _SC_CLK_TCK | Number of clock intervals per second |
| NGROUPS_MAX | _SC_NGROUPS_MAX | Maximum number of simultaneous supplementary group IDs per process |
| OPEN_MAX | _SC_OPEN_MAX | Maximum number of files that one process can have open at one time |
| PASS_MAX | _SC_PASS_MAX | Maximum number of significant characters in a password |
| _POSIX_JOB_CONTROL | _SC_JOB_CONTROL | Non-zero if the system supports POSIX job control; −1 otherwise |
| _POSIX_SAVED_IDS | _SC_SAVED_IDS | Non-zero if each process has a saved set-user-ID and a saved set-group-ID; −1 otherwise |
| _POSIX_VERSION | _SC_VERSION | Version of the POSIX Standard (such as 198808L) to which the system conforms. This value will change with each published revision of the standard, to indicate the year (first four digits) and month (next two digits) that the standard was approved by the IEEE Standards Board. If the system does not conform to any version, −1 is returned. |
The variables in the table are defined as constants in <limits.h> (see limits(5)). The associated values of the name argument are defined in <unistd.h>.
RETURN VALUE
If the value of name is not valid, sysconf returns −1 and sets errno to indicate the error. If the variable corresponding to name is not defined, sysconf returns −1; however, errno will not be changed.
Upon any successful completion, sysconf returns the value of the named variable, as described above. These values do not change during the lifetime of the calling process.
ERRORS
Sysconf fails if the following condition is true:
[EINVAL] The value of name is not valid.
EXAMPLES
The following example determines the number of times the system clock ticks each second:
#include <unistd.h>
long hz;
...
hz = sysconf(_SC_CLK_TCK);
AUTHOR
Sysconf was developed by HP and POSIX.
SEE ALSO
pathconf(2), unistd(5), limits(5).
STANDARDS CONFORMANCE
sysconf: XPG3, POSIX.1, FIPS 151-1
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989