sysconf(2)
NAME
sysconf − get configurable system variables
SYNOPSIS
#include <unistd.h>
long sysconf (name)
int name;
DESCRIPTION
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 variable to be queried. The following table lists the minimal set of system variables from <limits.h>, <unistd.h>, <time.h>, other system header files, or defined internal to the kernel that can be returned by sysconf(), and the symbolic constants, defined in <unistd.h>, that are the corresponding values used for name.
Configurable System Variables
VariableValue of name {ARG_MAX}{_SC_ARG_MAX}
{CHILD_MAX}{_SC_CHILD_MAX}
{CLK_TCK}{_SC_CLK_TCK}
{NGROUPS_MAX}{_SC_NGROUPS_MAX}
{OPEN_MAX}{_SC_OPEN_MAX}
{STREAM_MAX}{_SC_STREAM_MAX}
{TZNAME_MAX}{_SC_TZNAME_MAX}
{_POSIX_JOB_CONTROL}{_SC_JOB_CONTROL}
{_POSIX_SAVED_IDS}{_SC_SAVED_IDS}
{_POSIX_VERSION}{_SC_VERSION}
{_XOPEN_VERSION}{_SC_XOPEN_VERSION}
The following values for name are also defined in <unistd.h>:
_SC_BCS_VERSION
Get version number of 88open BCS to which the system conforms.
_SC_BCS_VENDOR_STAMP
Get BCS vendor stamp of the system.
_SC_BCS_SYS_ID
Get system hardware’s unique system ID number.
_SC_MAXUMEMV
Get maximum user process size, in Kbytes.
_SC_MAXUPROC
Get maximum number of processes per user.
_SC_MAXMSGSZ
Get maximum number of bytes in a message.
_SC_NMSGHDRS
Get maximum number of message headers in system.
_SC_SHMMAXSZ
Get the maximum size of a shared memory segment.
_SC_SHMMINSZ
Get the minimum size of a shared memory segment.
_SC_SHMSEGS
Get maximum number of attached shared memory segments per process.
_SC_NMSYSEM
Get number of semaphores in system.
_SC_MAXSEMVL
Get maximum semaphore value.
_SC_NSEMMAP
Get number of semaphore sets.
_SC_NSEMMSL
Get number of semaphores per set.
_SC_NSHMMNI
Get number of shared memory segments in the system.
_SC_ITIMER_VIRT
Determine whether or not system supports a timer.
_SC_ITIMER_PROF
Determine whether or not system supports a profiling timer.
_SC_TIMER_GRAN
Get granularity (in microseconds) of system’s real-time clock.
_SC_PHYSMEM
Get system’s physical memory size in Kbytes.
_SC_AVAILMEM
Get amount of physical memory available to user processes, in Kbytes.
_SC_NICE Determine whether or not nice() process prioritization is supported on system.
_SC_MEMCTL_UNIT
Get number of bytes in a memctl() memory unit.
_SC_SHMLBA
Get number of bytes used as rounding factor on memory addresses by shmsys().
_SC_CPUID Get the value stored in the M88000 Processor Identification Register.
_SC_BSDNETWORK
Determine whether or not system supports the BSD Networking Extension.
_SC_NPTYS Get the number of pseudo terminals configured on the system.
_SC_AIO Determine if the Interim Asynchronous I/O Extension is supported.
_SC_RWX_SUPPORT
Determine if RWX support is present.
The following values for name are supported on all architectures.
_SC_AIO_MAX
Determine the maximum number of asynchronous I/O requests that can be outstanding in the system at any given time.
_SC_ASYNCHRONOUS_IO
Determine whether or not system supports asynchronous I/O.
_SC_LISTIO_AIO_MAX
Determine the maximum number of I/O operations in a single list I/O call that is supported by the implementation.
_SC_MEMLOCK
Determine whether or not the system supports process memory locking.
_SC_MEMLOCK_RANGE
Determine whether or not the system supports locking of portions of a process’ memory.
_SC_PASSMAX
Get the maximum number of characters in a password.
_SC_PAGESIZE
Get the number of bytes in a memory page.
_SC_PRIORITIZED_IO
Determine whether or not the system supports prioritized I/O. Only disk files support prioritized I/O.
_SC_REALTIME_SIGNALS
Determine if the implementation supports realtime signals (see {_POSIX_REALTIME_SIGNALS}).
_SC_RTSIG_MAX
Get the number of realtime signal numbers that are reserved for use by the application (see {_POSIX_RTSIG_MAX} and {RTSIG_MAX}).
_SC_SVSTREAMS
Determine whether or not system supports System V style streams.
RETURN VALUE
If name is an invalid value, sysconf() will return −1 and set errno to indicate the error. If the variable corresponding to name is not defined on the system, sysconf() returns −1 without changing errno.
Otherwise, the sysconf() function returns the current variable value on the system. The value returned will not be more restrictive than the corresponding value described to the application when it was compiled with <limits.h> or <unistd.h>. The value will not change during the lifetime of the calling process.
ERRORS
If any of the following conditions occur, the sysconf() function shall return −1 and set errno to the corresponding value:
[EINVAL] The value of the name argument is invalid.
CX/UX Programmer’s Reference Manual