sysconf

Gets configurable system variables.

Format

#include  <unistd.h>

long int sysconf  (int name);

Arguments

name
Specifies the system variable to be queried.

Description

This function provides a method for determining the current value of a configurable system limit or whether optional features are supported.

You supply a symbolic constant in the name argument, and sysconf returns a value for the corresponding system variable:

Table 12 lists the system variables returned by the sysconf function, and the symbolic constants that you can supply as the name value.

Table 12 SYSCONF Argument and Return Values

System Variable Returned  Symbolic Constant for name  Meaning 
ISO POSIX-1 
ARG_ MAX  _SC_ARG_MAX   The maximum length, in bytes, of the arguments for one of the exec functions, including environment data. 
CHILD_MAX  _SC_CHILD_MAX   The maximum number of simultaneous processes for each real user ID. 
CLK_ TCK  _SC_CLK_TCK   The number of clock ticks per second. The value of CLK_TCK can be variable. Do not assume that CLK_TCK is a compile time constant. 
NGROUPS_MAX  _SC_NGROUPS_MAX   The maximum number of simultaneous supplementary group IDs for each process. 
OPEN_MAX  _ SC_OPEN_MAX   The maximum number of files that one process can have open at one time. 
STREAM_ MAX  _SC_STREAM_MAX   The number of streams that one process can have open at one time. 
TZNAME_MAX  _SC_TZNAME_MAX   The maximum number of bytes supported for the name of a time zone (not the length of the TZ environmental variable). 
_POSIX_JOB_CONTROL  _SC_JOB_CONTROL   This variable has a value of 1 if the system supports job control; otherwise, -1 is returned. 
_POSIX_SAVED_IDS  _SC_SAVED_IDS   This variable has a value of 1 if each process has a saved set user ID and a saved set group ID; otherwise, -1 is returned. 
_POSIX_VERSION  _ SC_VERSION   The date of approval of the most current version of the POSIX-1 standard that the system supports. The date is a 6-digit number, with the first 4 digits signifying the year and the last 2 digits the month.

If_POSIX_VERSION is not defined, -1 is returned.

Different versions of the POSIX-1 standard are periodically approved by the IEEE Standards Board, and the date of approval is used to distinguish between different versions. 

ISO POSIX-2 
BC_ BASE_MAX  _SC_BC_BASE_MAX   The maximum value allowed for the obase variable with the bc command. 
BC_DIM_MAX  _SC_BC_DIM_MAX   The maximum number of elements permitted in an array by the bc command. 
BC_SCALE_MAX  _SC_ BC_SCALE_MAX   The maximum value allowed for the scale variable with the bc command. 
BC_STRING_ MAX  _SC_BC_STRING_MAX   The maximum length of string constants accepted by the bc command. 
COLL_WEIGHTS_MAX  _SC_COLL_WEIGHTS_ MAX   The maximum number of weights that can be assigned to an entry in the LC_COLLATE locale-dependent information in a locale definition file. 
EXPR_NEST_ MAX  _SC_EXPR_NEST_MAX   The maximum number of expressions that you can nest within parentheses by the expr command. 
LINE_MAX  _SC_LINE_MAX   The maximum length, in bytes, of a command input line (either standard input or another file) when the utility is described as processing text files. The length includes room for the trailing newline character. 
RE_DUP_MAX  _SC_RE_DUP_MAX   The maximum number of repeated occurrences of a regular expression permitted when using the interval notation arguments, such as the m and n arguments with the ed command. 
_POSIX2_CHAR_TERM  _SC_2_CHAR_TERM   This variable has a value of 1 if the system supports at least one terminal type; otherwise, -1 is returned. 
_POSIX2_C_BIND  _SC_2_C_BIND   This variable has a value of 1 if the system supports the C language binding option; otherwise, -1 is returned. 
_POSIX2_C_DEV  _SC_2_C_DEV   This variable has a value of 1 if the system supports the optional C Language Development Utilities from the ISO POSIX-2 standard; otherwise, -1 is returned. 
_POSIX2_C_VERSION  _SC_2_C_VERSION   Integer value indicating the version of the ISO POSIX-2 standard (C language binding). It changes with each new version of the ISO POSIX-2 standard. 
_POSIX2_VERSION  _SC_2_VERSION   Integer value indicating the version of the ISO POSIX-2 standard (Commands). It changes with each new version of the ISO POSIX-2 standard. 
_POSIX2_FORT_ DEV  _SC_2_FORT_DEV   The variable has a value of 1 if the system supports the FORTRAN Development Utilities Option from the ISO POSIX-2 standard; otherwise, -1 is returned. 
_POSIX2_FORT_RUN  _SC_2_FORT_RUN   The variable has a value of 1 if the system supports the FORTRAN Runtime Utilities Option from the ISO POSIX-2 standard; otherwise, -1 is returned. 
_POSIX2_LOCALEDEF  _SC_2_LOCALEDEF   The variable has a value of 1 if the system supports the creation of new locales with the localedef command; otherwise, -1 is returned. 
_POSIX2_SW_DEV  _SC_2_SW_DEV   The variable has a value of 1 if the system supports the Software Development Utilities Option from the ISO POSIX-2 standard; otherwise, -1 is returned. 
_POSIX2_UPE  _SC_2_UPE   The variable has a value of 1 if the system supports the User Portability Utilities Option; otherwise, -1 is returned. 
POSIX 1003.1c-1995 
_POSIX_THREADS  _SC_THREADS   This variable has a value of 1 if the system supports POSIX threads; otherwise, -1 is returned. 
_ POSIX_THREAD_ATTR_STACKSIZE  _SC_THREAD_ATTR_ STACKSIZE   This variable has a value of 1 if the system supports the POSIX threads stack size attribute; otherwise, -1 is returned. 
_POSIX_THREAD_ PRIORITY_SCHEDULING  _SC_THREAD_PRIORITY_SCHEDULING   The 1003.1c implementation supports the realtime scheduling functions. 
_POSIX_THREAD_SAFE_ FUNCTIONS  _SC_THREAD_SAFE_FUNCTIONS   TRUE if the implementation supports the thread-safe ANSI C functions in POSIX 1003.1c. 
PTHREAD_ DESTRUCTOR_ITERATIONS  _SC_THREAD_DESTRUCTOR_ ITERATIONS   When a thread terminates, DECthreads iterates through all non-NULL thread-specific data values in the thread, and calls a registered destructor routine (if any) for each. It is possible for a destructor routine to create new values for one or more thread-specific data keys. In that case, DECthreads goes through the entire process again.

_SC_THREAD_DESTRUCTOR_ITERATIONS is the maximum number of times the implementation loops before it terminates the thread even if there are still non-NULL values. 

PTHREAD_KEYS_MAX  _SC_THREAD_KEYS_MAX   The maximum number of thread-specific data keys that an application can create. 
PTHREAD_STACK_ MIN  _SC_THREAD_STACK_MIN   The minimum allowed size of a stack for a new thread. Any lower value specified for the "stacksize" thread attribute is rounded up. 
UINT_MAX  _SC_THREAD_ THREADS_MAX   The maximum number of threads an application is allowed to create. Since DECthreads does not enforce any fixed limit, this value is -1. 
X/Open 
_XOPEN_ VERSION  _SC_XOPEN_VERSION   An integer indicating the most current version of the X/OPEN standard that the system supports. 
PASS_MAX  _SC_PASS_MAX   Maximum number of significant bytes in a password (not including terminating null). 
XOPEN_CRYPT  _SC_XOPEN_CRYPT   This variable has a value of 1 if the system supports the X/Open Encryption Feature Group; otherwise, -1 is returned. 
XOPEN_ENH_I18N  _SC_XOPEN_ENH_I18N   This variable has a value of 1 if the system supports the X/Open enhanced Internationalization Feature Group; otherwise, -1 is returned. 
XOPEN_ SHM  _SC_XOPEN_SHM   This variable has a value of 1 if the system supports the X/Open Shared Memory Feature Group; otherwise, -1 is returned. 
X/Open Extended 
ATEXIT_MAX  _SC_ATEXIT_MAX   The maximum number of functions that you can register with atexit per process. 
PAGESIZE  _SC_ PAGESIZE   Size in bytes of a page. 
PAGE SIZE  _SC_PAGE_SIZE   Same as PAGESIZE. If either PAGESIZE or PAGE_SIZE is defined, the other is defined with the same value. 
IOV_ MAX  _SC_IOV_MAX   Maximum number of iovec structures that one process has available for use with readv or writev. 
XOPEN_UNIX  _ SC_XOPEN_UNIX   This variable has a value of 1 if the system supports the X/Open CAE Specification, August 1994, System Interfaces and Headers, Issue 4, Version 2, (ISBN: 1-85912-037-7, C435); otherwise, -1 is returned. 

Return Values
The current variable value on the system. The value does not change during the lifetime of the calling process. 
-1  Indicates an error.

If the value of the name argument is invalid, errno is set to indicate the error.

If the value of the name argument is undefined, errno is unchanged.  


Previous Page | Next Page | Table of Contents | Index