sysconf(3C)
NAME
sysconf − get configurable system variables
SYNOPSIS
#include <unistd.h>
long sysconf(int name);
MT-LEVEL
Safe
DESCRIPTION
The sysconf() function provides a method for an 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.
NameReturn ValueMeaning
_SC_ARG_MAXARG_MAXMax combined size of argv[]
and envp[]
_SC_CHILD_MAXCHILD_MAXMax processes allowed to any UID
_SC_CLK_TCKCLK_TCKTicks per second (clock_t)
_SC_NGROUPS_MAXNGROUPS_MAXMax simultaneous groups one
process may belong to
_SC_OPEN_MAXOPEN_MAXMax open files per process
_SC_PASS_MAXPASS_MAX
_SC_PAGESIZEPAGESIZESystem memory page size
_SC_JOB_CONTROL_POSIX_JOB_CONTROLJob control supported
(boolean)
_SC_SAVED_IDS_POSIX_SAVED_IDSSaved ids (seteuid(2))
supported (boolean)
_SC_VERSION_POSIX_VERSIONVersion of the POSIX.1 standard
supported
_SC_XOPEN_VERSION_XOPEN_VERSION
_SC_LOGNAME_MAXLOGNAME_MAX
_SC_NPROCESSORS_CONFNumber of processors (CPUs)
configured
_SC_NPROCESSORS_ONLNNumber of processors online
_SC_PHYS_PAGESThe total number of pages of physical
memory in the system.
_SC_AVPHYS_PAGESThe number of pages of physical memory
not currently in use by the system.
_SC_AIO_LISTIO_MAXAIO_LISTIO_MAXMaximum number of I/O operations in a
single list I/O call supported by the
implementation.
_SC_AIO_MAXAIO_MAXMaximum number of outstanding
asynchronous I/O operations supported
by the implementation.
_SC_AIO_PRIO_DELTA_MAXAIO_PRIO_DELTA_MAX The maximum amount
by which a process can
decrease its asynchronous
I/O priority level from its
own scheduling priority.
_SC_DELAYTIMER_MAXDELAYTIMER_MAXMaximum number of
timer expiration overruns.
_SC_MQ_OPEN_MAXMQ_OPEN_MAXThe maximum number of open
message queue descriptors
a process may hold.
_SC_MQ_PRIO_MAXMQ_PRIO_MAXThe maximum number of message
priorities supported by the
implementation.
_SC_RTSIG_MAXRTSIG_MAXMaximum number of realtime
signals reserved for application
use in this implementation.
_SC_SEM_NSEMS_MAXSEM_NSEMS_MAXMaximum number of semaphores
that a process may have.
_SC_SEM_VALUE_MAXSEM_VALUE_MAXThe maximum value a
semaphore may have.
_SC_SIGQUEUE_MAXSIGQUEUE_MAXMaximum number of queued
signals that a process may
send and have pending at the
receiver(s) at any time.
_SC_TIMER_MAXTIMER_MAXMaximum number of timers
per process supported by
the implementation.
_SC_ASYNCHRONOUS_IO_POSIX_ASYNCHRONOUS_IO Supports Asynchronous
Input and Output.
_SC_FSYNC_POSIX_FSYNCSupports File Synchronization.
_SC_MAPPED_FILES_POSIX_MAPPED_FILESSupports Memory Mapped Files.
_SC_MEMLOCK_POSIX_MEMLOCKSupports Process Memory Locking.
_SC_MEMLOCK_RANGE_POSIX_MEMLOCK_RANGESupports Range Memory Locking.
_SC_MEMORY_PROTECTION_POSIX_MEMORY_PROTECTION Supports Memory Protection.
_SC_MESSAGE_PASSING_POSIX_MESSAGE_PASSINGSupports Message Passing.
_SC_PRIORITIZED_IO_POSIX_PRIORITIZED_IOSupports Prioritized Input
and Output.
_SC_PRIORITY_SCHEDULING_POSIX_PRIORITY_SCHEDULING Supports Process Scheduling
_SC_REALTIME_SIGNALS_POSIX_REALTIME_SIGNALS Supports Realtime Signals
Extension.
_SC_SEMAPHORES_POSIX_SEMAPHORESSupports Semaphores.
_SC_SHARED_MEMORY_OBJECTS _POSIX_SHARED_MEMORY_OBJECTS Supports Shared
Memory Objects.
_SC_SYNCHRONIZED_IO_POSIX_SYNCHRONIZED_IOSupports Synchronized
Input and Output.
_SC_TIMERS_POSIX_TIMERSSupports Timers.
RETURN VALUES
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.
SEE ALSO
fpathconf(2), seteuid(2), setrlimit(2)
NOTES
A call to setrlimit() may cause the value of OPEN_MAX to change.
Multiplying sysconf(_SC_PHYS_PAGES) or sysconf(_SC_AVPHYS_PAGES) by sysconf(_SC_PAGESIZE) to determine memory amount in bytes can exceed the maximum values representable in a long or unsigned long.
_SC_PHYS_PAGES and _SC_AVPHYS_PAGES are specific to Solaris 2.3 and later releases.
The value of CLK_TCK may be variable and it should not be assumed that CLK_TCK is a compile-time constant.
Sun Microsystems — Last change: 22 Jan 1993