[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    sysconf(3C) manual page Table of Contents

Name

sysconf - get configurable system variables

Synopsis

#include <unistd.h>

long sysconf(int name);

Availability

SPARC, x86, PowerPC

MT-Level

MT-Safe, Async-Signal-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 on the SPARC, x86 and PowerPC platforms.

NameReturn ValueMeaning
_SC_ARG_MAXARG_MAXMax size of argv[] plus envp[].
_SC_CHILD_MAXCHILD_MAXMax processes allowed to a UID .
_SC_CLK_TCKCLK_TCKTicks per second (clock_t).
_SC_NGROUPS_MAXNGROUPS_MAXMax simultaneous groups
to which one may belong.
_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?
_SC_SAVED_IDS_POSIX_SAVED_IDSSaved IDs (seteuid()) supported?
_SC_VERSION_POSIX_VERSIONPOSIX.1 version supported.
_SC_XOPEN_VERSION_XOPEN_VERSION
_SC_LOGNAME_MAXLOGNAME_MAX
_SC_NPROCESSORS_CONFNumber of processors configured.
_SC_NPROCESSORS_ONLNNumber of processors online.
_SC_PHYS_PAGESTotal number of pages of
physical memory in system.
_SC_AVPHYS_PAGESNumber physical memory pages
not currently in use by system.
_SC_AIO_LISTIO_MAXAIO_LISTIO_MAXMax number of I/O operations
in a single list I/O call
supported by implementation.
_SC_AIO_MAXAIO_MAXMax number of outstanding
asynchronous I/O operations
supported by implementation.
_SC_AIO_PRIO_DELTA_MAXAIO_PRIO_DELTA_MAXMax amount by which a process
can decrease its asynchronous
/O priority level from its own
scheduling priority.
_SC_DELAYTIMER_MAXDELAYTIMER_MAXMax number of timer
expiration overruns.
_SC_GETGR_R_SIZE_MAXNSS_BUFLEN_GROUPMax size of group entry buffer.
_SC_GETPW_R_SIZE_MAXNSS_BUFLEN_PASSWDMax size of password entry buffer.
_SC_LOGIN_NAME_MAXLOGNAME_MAX + 1 Max length of login name.
_SC_MQ_OPEN_MAXMQ_OPEN_MAXMax number of open message
queues a process may hold.
_SC_MQ_PRIO_MAXMQ_PRIO_MAXMax number of message priorities
supported by implementation.
_SC_RTSIG_MAXRTSIG_MAXMax number of realtime signals
reserved for application use
in this implementation.
_SC_SEM_NSEMS_MAXSEM_NSEMS_MAXMax number of semaphores
that a process may have.
_SC_SEM_VALUE_MAXSEM_VALUE_MAXMax value a semaphore may have.
_SC_SIGQUEUE_MAXSIGQUEUE_MAXMax number of queued signals
that a process may send and have
pending at receiver(s) at a time.
_SC_TIMER_MAXTIMER_MAXMax number of timers per process
supported by implementation.
_SC_ASYNCHRONOUS_IO_POSIX_ASYNCHRONOUS_IOSupports Asynchronous I/O.
_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_PROTECTIONSupports Memory Protection.
_SC_MESSAGE_PASSING_POSIX_MESSAGE_PASSINGSupports Message Passing.
_SC_PRIORITIZED_IO_POSIX_PRIORITIZED_IOSupports Prioritized I/O.
_SC_PRIORITY_SCHEDULING_POSIX_PRIORITY_SCHEDULINGSupports Process Scheduling
_SC_REALTIME_SIGNALS_POSIX_REALTIME_SIGNALSSupports Realtime Signals.
_SC_SEMAPHORES_POSIX_SEMAPHORESSupports Semaphores.
_SC_SHARED_MEMORY__POSIX_SHARED_MEMORY_Supports Shared Memory
 OBJECTS  OBJECTS Objects.
_SC_SYNCHRONIZED_IO_POSIX_SYNCHRONIZED_IOSupports Synchronized I/O.
_SC_TIMERS_POSIX_TIMERSSupports Timers.
_SC_THREAD_DESTRUCTOR_PTHREAD_DESTRUCTOR_Number attempts made to destroy
 ITERATIONS  ITERATIONSthread-specific data on thread exit.
_SC_THREAD_KEYS_MAXPTHREAD_KEYS_MAXMax number of data keys
per process.
_SC_THREAD_STACK_MINPTHREAD_STACK_MINMin byte size of thread
stack storage.
_SC_THREAD_THREADS_MAXPTHREAD_THREADS_MAXMax number of threads per process.
_SC_TTY_NAME_MAXTTYNAME_MAXMax length of tty device name.
_SC_THREADS _POSIX_THREADSSupports Threads option.
_SC_THREAD_ATTR_STACKADDR _POSIX_THREAD_ATTR_STACKADDR
 Supports Thread Stack Address Attribute option.
_SC_THREAD_ATTR_STACKSIZE _POSIX_THREAD_ATTR_STACKSIZE
 Supports Thread Stack Size Attribute option.
_SC_THREAD_PRIORITY_SCHEDULING _POSIX_THREAD_PRIORITY_SCHEDULING
 Supports Thread Execution Scheduling option.
_SC_THREAD_PRIO_INHERIT _POSIX_THREAD_PRIO_INHERIT
 Supports Priority Inheritance option.
_SC_THREAD_PRIO_PROTECT _POSIX_THREAD_PRIO_PROTECT
 Supports Priority Protection option.
_SC_THREAD_PROCESS_SHARED _POSIX_THREAD_PROCESS_SHARED
 Supports Process-Shared Synchronization option.
_SC_THREAD_SAFE_FUNCTIONS _POSIX_THREAD_SAFE_FUNCTIONS
 Supports Thread-Safe Functions option.

The following table lists the names and return values for platform-specific system variables.

NameReturn Value
SPARC , x86PowerPC
_SC_COHER_BLKSZEINVALCache coherency size in bytes.
_SC_SPLIT_CACHEEINVAL0 for non-split or 1 for split.
_SC_ICACHE_SZEINVALSize of icache in bytes.
_SC_DCACHE_SZEINVALSize of data cache in bytes.
_SC_ICACHE_LINESZEINVALInstruction cache line size in bytes.
_SC_DCACHE_LINESZEINVALData cache line size in bytes.
_SC_ICACHE_BLKSZEINVALBlock size invalidated in icache by
icbi in bytes.
_SC_DCACHE_BLKSZEINVALBlock size for dcbz, dcbst, dcbf
and dcbi in bytes.
_SC_DCACHE_TBLKSZEINVALBlock size for dcache prefetch by dcbt
and dcbtst in bytes.
_SC_ICACHE_ASSOCEINVALIcache associativity (2 = 2-way...).
_SC_DCACHE_ASSOCEINVALDcache associativity (2 = 2-way...).
_SC_PPC_GRANULE_SZEINVALGranule size for reservations by lwarx
in bytes.
_SC_PPC_TB_TICKSPSECHEINVALCurrently returns 0 (reserved for future expansion).
_SC_PPC_TB_TICKSPSECLEINVALReturns the rate at which the timebase
is updated.

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.

Calling sysconf() with _SC_THREAD_KEYS_MAX or _SC_THREAD_THREADS_MAX returns -1, because no maximum limit can be determined. The system supports at least the minimum values defined by _POSIX_THREAD_KEYS_MAX and _POSIX_THREAD_THREADS_MAX and can support higher values depending upon system resources.

_SC_THREAD_PRIO_INHERIT and _SC_THREAD_PRIO_PROTECT are currently not supported, so sysconf() with these arguments returns -1.


Table of Contents