sysconf() - get configurable system variables
#include <unistd.h>
long sysconf (int name)
This interface is defined by
The sysconf(2) function provides a method for applications to determine the current value of a configurable system limit or option variable. The name argument specifies the system variable to be queried. Symbolic constants for each name value are found in the include file <unistd.h>.
The definitive list of symbolic constants is in the include file. As of this writing, the available values are as follows:
sysconf() Name | Description |
---|---|
_SC_2_C_BIND | Whether system provides POSIX.2 C language bindings |
_SC_2_C_DEV | Whether system supports the POSIX.2 C-Language Development Utilities Option |
_SC_2_CHAR_TERM | Whether system supports at least one terminal type capable of supporting all operations described in POSIX.2 |
_SC_2_FORT_RUN | Whether system supports POSIX.2 FORTRAN Runtime Utilities Option |
_SC_2_FORT_DEV | Whether system supports POSIX.2 FORTRAN Development Utilities Option |
_SC_2_LOCALEDEF | Whether system supports the creation of locales |
_SC_2_SW_DEV | Whether system supports POSIX.2 Software Development Portability Utilities Option |
_SC_2_UPE | Whether system supports POSIX.2 User Portability Utilities Option |
_SC_2_VERSION | Version of ISO/IEC 9945 (POSIX 1003.2) with which the system attempts to comply. |
_SC_ARG_MAX | Maximum bytes of argument to exec(). |
_SC_BC_BASE_MAX | Maximum obase value allowed by bc |
_SC_BC_DIM_MAX | Maximum number of elements in a bc array |
_SC_BC_SCALE_MAX | Maximum scale value allowed by bc |
_SC_BC_STRING_MAX | Maximum length of a string constant in bc |
_SC_CHILD_MAX | Maximum number of simultaneous processes per user ID. |
_SC_CLK_TCK | Number of micro-seconds per hz tick. |
_SC_COLL_WEIGHTS_MAX | In a locale definition file, the maximum number of weights that can be assigned to the LC_COLLATE order keyword |
_SC_EXPR_NEST_MAX | Maximum number of expressions that can be nested within parentheses by expr |
_SC_JOB_CONTROL | Return 1 if job control is available on this system, otherwise -1. |
_SC_LINE_MAX | Maximum length in bytes, including trailing newline, of an input line for a text-processing utility |
_SC_NGROUPS_MAX | Maximum number of supplemental groups. |
_SC_OPEN_MAX | Maximum number of open files per process. |
_SC_PAGE_SIZE | The virtual memory page size. This is always 65536 (64 KB), regardless of the actual Windows page size. |
_SC_PAGESIZE | The virtual memory page size. This is always 65536 (64 KB), regardless of the actual Windows page size. |
_SC_RE_DUP_MAX | Maximum number of repetitions of a BRE allowed in \{m,n\} notation |
_SC_SAVED_IDS | Returns 1 if saved set-group and saved set-user ID is available, otherwise -1. |
_SC_STREAM_MAX | Minimum maximum number of streams that a process may have open at any one time. |
_SC_TZNAME_MAX | Minimum maximum number of types supported for the name of a timezone. |
_SC_VERSION | The version of ISO/IEC 9945 (POSIX 1003.1) with which the system attempts to comply. |
If the call to sysconf(2) is not successful, the function returns -1 and sets errno appropriately. If the variable is associated with functionality that isn't supported or if the variable is not valid, the function returns -1 and does not set errno
Otherwise, the current variable value is returned.
The sysconf(2) function may fail and set errno for any of these errors: