sysconf(3C) — C LIBRARY FUNCTIONS
NAME
sysconf − retrieves configurable system variables
SYNOPSIS
#include <unistd.h>
long sysconf(int name);
DESCRIPTION
Multiprocessing supports the following new name values:
_SC_NPROC_CONF
Number of currently configured processors.
_SC_NPROC_ONLN
Number of processors currently online.
The sysconf function provides a method for the application to determine the current value of a configurable system limit or option (variable).
The name argument represents the system variable to be queried. The following table lists the minimal set of system variables from limits.h and unistd.h that can be returned by sysconf, and the symbolic constants, defined in unistd.h that are the corresponding values used for name.
| NAME | RETURN VALUE |
| _SC_CHILD_MAX | CHILD_MAX |
| _SC_CLK_TCK | CLK_TCK |
| _SC_NGROUPS_MAX | NGROUPS_MAX |
| _SC_OPEN_MAX | OPEN_MAX |
| _SC_PASS_MAX | PASS_MAX |
| _SC_PAGESIZE | PAGESIZE |
| _SC_JOB_CONTROL | _POSIX_JOB_CONTROL |
| _SC_SAVED_IDS | _POSIX_SAVED_IDS |
| _SC_VERSION | _POSIX_VERSION |
| _SC_XOPEN_VERSION | _XOPEN_VERSION |
| _SC_LOGNAME_MAX | LOGNAME_MAX |
| _SC_NPROC_CONF | # configured processors |
| _SC_NPROC_ONLN | # processors online |
| _SC_ARCH_VERSION | # 0 on 88100, 1 on 88110 |
The value of CLK_TCK may be variable and it should not be assumed that CLK_TCK is a compile-time constant. The value of CLK_TCK is the same as the value of sysconf(_SC_CLK_TCK).
The unique system identifier returned by sysconf (_SC_BCS_SYS_ID) is determined as follows: If there is a valid system serial number loaded into the NVRAM on the cpu board, then that serial number will be returned. Otherwise, the lower four bytes of the unique Ethernet address of the Ethernet board with the lowest board type will be returned. If two or more Ethernet boards have the same lowest board type, the address of the board with the lowest board type with the lowest minor device value will be returned.
For example, given this configuration:
| Board | Minor Device | Ethernet Address |
| MVME376 | 0 | 0x10000000 |
| MVME374 | 1 | 0x20000000 |
| MVME374 | 0 | 0x30000000 |
sysconf(_SC_BCS_SYS_ID) returns: 0x30000000
This algorithm can be overridden by uadmin(1M). See the Release Notes for details.
DIAGNOSTICS
sysconf returns the appropriate value on success, or a negative value on failure.
Failure may result from:
EINVAL The name argument is invalid.
If name is an invalid value, sysconf will return −1 and set errno to indicate the error. If sysconf fails due to a value of name that is not defined on the system, the function will return a value of −1 without changing the value of errno.
NOTES
A call to setrlimit may cause the value of OPEN_MAX to change.
SEE ALSO
— Multiprocessing