Standard C Library Functions sysconf(3C)
NAME
sysconf - get configurable system variables
SYNOPSIS
#include
long sysconf(int name);
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 fromand that can be returned by sysconf() and the symbolic constants defined in
that are the corresponding values used for name on the SPARC and x86 platforms. Name Return Value Meaning _______________________________________________________________________
_SC_2_C_BIND _POSIX2_C_BIND Supports the C lang-
uage binding option_SC_2_C_DEV _POSIX2_C_DEV Supports the C lang-
uage development utilities option_SC_2_C_VERSION _POSIX2_C_VERSION Integer value
indicates versionof ISO POSIX-2
standard (Commands)_SC_2_CHAR_TERM _POSIX2_CHAR_TERM Supports at least
one terminal_SC_2_FORT_DEV _POSIX2_FORT_DEV Supports FORTRAN
Development Utilities Option_SC_2_FORT_RUN _POSIX2_FORT_RUN Supports FORTRAN
Run-time Utilities
Option_SC_2_LOCALEDEF _POSIX2_LOCALEDEF Supports creation
of locales by the localedef utility_SC_2_SW_DEV _POSIX2_SW_DEV Supports Software
Development Utility Option_SC_2_UPE _POSIX2_UPE Supports User
Portability Utilities Option_SC_2_VERSION _POSIX2_VERSION Integer value
indicates versionSunOS 5.11 Last change: 26 Mar 2008 1
Standard C Library Functions sysconf(3C)
of ISO POSIX-2
standard (C language binding)_SC_AIO_LISTIO_MAX AIO_LISTIO_MAX Max number of I/O
operations in asingle list I/O call supported
_SC_AIO_MAX AIO_MAX Max number of
outstandingasynchronous I/O operations supported
_SC_AIO_PRIO_DELTA_MAX AIO_PRIO_DELTA_MAX Max amount by which
process can decrease its asynchronousI/O priority level from its own scheduling priority
_SC_ARG_MAX ARG_MAX Max size of argv[]
plus envp[]_SC_ASYNCHRONOUS_IO _POSIX_ASYNCHRONOUS_IO Supports
Asynchronous I/O
_SC_ATEXIT_MAX ATEXIT_MAX Max number of
functions that can be registered with atexit()_SC_AVPHYS_PAGES Number of physical
memory pages not currently in use by system_SC_BARRIERS _POSIX_BARRIERS Supports Barriers
option_SC_BC_BASE_MAX BC_BASE_MAX Maximum obase values
allowed by bc_SC_BC_DIM_MAX BC_DIM_MAX Max number of
elements permitted in array by bc_SC_BC_SCALE_MAX BC_SCALE_MAX Max scale value
allowed by bc_SC_BC_STRING_MAX BC_STRING_MAX Max length of string
constant allowed by bc_SC_CHILD_MAX CHILD_MAX Max processes
allowed to a UID_SC_CLK_TCK CLK_TCK Ticks per second
(clock_t)
_SC_CLOCK_SELECTION _POSIX_CLOCK_SELECTION Supports Clock
Selection option_SC_COLL_WEIGHTS_MAX COLL_WEIGHTS_MAX Max number of
weights that can be assigned to entry ofthe LC_COLLATE order
keyword in localeSunOS 5.11 Last change: 26 Mar 2008 2
Standard C Library Functions sysconf(3C)
definition file_SC_CPUID_MAX Max possible
processor ID_SC_DELAYTIMER_MAX DELAYTIMER_MAX Max number of timer
expiration overruns_SC_EXPR_NEST_MAX EXPR_NEST_MAX Max number of
parentheses by expr_SC_FSYNC _POSIX_FSYNC Supports File
Synchronization_SC_GETGR_R_SIZE_MAX Max size of group
entry buffer_SC_GETPW_R_SIZE_MAX Max size of password
entry buffer_SC_HOST_NAME_MAX _POSIX_HOST_NAME_MAX Maximum length of a
host name (excluding terminating null)_SC_IOV_MAX IOV_MAX Max number of iovec
structures available to one process for use with readv() and writev()_SC_JOB_CONTROL _POSIX_JOB_CONTROL Job control
supported?_SC_LINE_MAX LINE_MAX Max length of input
line_SC_LOGIN_NAME_MAX LOGNAME_MAX + 1 Max length of login
name_SC_LOGNAME_MAX LOGNAME_MAX
_SC_MAPPED_FILES _POSIX_MAPPED_FILES Supports Memory
Mapped Files_SC_MAXPID Max pid value
_SC_MEMLOCK _POSIX_MEMLOCK Supports Process
Memory Locking_SC_MEMLOCK_RANGE _POSIX_MEMLOCK_RANGE Supports Range
Memory Locking_SC_MEMORY_PROTECTION _POSIX_MEMORY_PROTECTION Supports Memory
Protection_SC_MESSAGE_PASSING _POSIX_MESSAGE_PASSING Supports Message
Passing_SC_MONOTONIC_CLOCK _POSIX_MONOTONIC_CLOCK Supports Monotonic
Clock option_SC_MQ_OPEN_MAX MQ_OPEN_MAX Max number of open
message queues a process can hold_SC_MQ_PRIO_MAX MQ_PRIO_MAX Max number of
message priorities supported_SC_NGROUPS_MAX NGROUPS_MAX Max simultaneous
groups to which one can belong_SC_NPROCESSORS_CONF Number of processors
configuredSunOS 5.11 Last change: 26 Mar 2008 3
Standard C Library Functions sysconf(3C)
_SC_NPROCESSORS_MAX Max number of
processors supported by platform_SC_NPROCESSORS_ONLN Number of processors
online_SC_OPEN_MAX OPEN_MAX Max open files per
process_SC_PAGESIZE PAGESIZE System memory page
size_SC_PAGE_SIZE PAGESIZE Same as _SC_PAGESIZE
_SC_PASS_MAX PASS_MAX Max number of
significant bytes in a password_SC_PHYS_PAGES Total number of
pages of physical memory in system_SC_PRIORITIZED_IO _POSIX_PRIORITIZED_IO Supports Prioritized
I/O
_SC_PRIORITY_SCHEDULING _POSIX_PRIORITY_SCHEDULING Supports Process
Scheduling_SC_RAW_SOCKETS _POSIX_RAW_SOCKETS Supports Raw Sockets
option_SC_RE_DUP_MAX RE_DUP_MAX Max number of
repeated occurrences of a regular expression permitted when using interval notation \{m,n\}_SC_READER_WRITER_LOCKS _POSIX_READER_WRITER_LOCKS Supports IPV6 option
_SC_REALTIME_SIGNALS _POSIX_REALTIME_SIGNALS Supports Realtime
Signals_SC_REGEXP _POSIX_REGEXP Supports Regular
Expression Handling option_SC_RTSIG_MAX RTSIG_MAX Max number of
realtime signals reserved for application use_SC_SAVED_IDS _POSIX_SAVED_IDS Saved IDs
(seteuid()) supported?_SC_SEM_NSEMS_MAX SEM_NSEMS_MAX Max number of POSIX
semaphores a process can have_SC_SEM_VALUE_MAX SEM_VALUE_MAX Max value a POSIX
semaphore can have_SC_SEMAPHORES _POSIX_SEMAPHORES Supports Semaphores
_SC_SHARED_MEMORY_ _POSIX_SHARED_MEMORY_ Supports Shared
OBJECTS OBJECTS Memory Objects_SC_SHELL _POSIX_SHELL Supports POSIX shell
_SC_SIGQUEUE_MAX SIGQUEUE_MAX Max number of queued
signals that aSunOS 5.11 Last change: 26 Mar 2008 4
Standard C Library Functions sysconf(3C)
process can send and have pending at receiver(s) at a time_SC_SPAWN _POSIX_SPAWN Supports Spawn option
_SC_SPIN_LOCKS _POSIX_SPIN_LOCKS Supports Spin Locks
option_SC_STACK_PROT Default stack
protection_SC_STREAM_MAX STREAM_MAX Number of streams
one process can have open at a time_SC_SYMLOOP_MAX _POSIX_SYMLOOP_MAX Max number of symbolic
links that can be reliably traversed in the resolution of a pathname in the absence of a loop_SC_SYNCHRONIZED_IO _POSIX_SYNCHRONIZED_IO Supports
Synchronized I/O
_SC_THREAD_ATTR_ _POSIX_THREAD_ATTR_ Supports Thread
STACKADDR STACKADDR Stack Address Attribute option_SC_THREAD_ATTR_ _POSIX_THREAD_ATTR_ Supports Thread
STACKSIZE STACKSIZE Stack Size Attribute option_SC_THREAD_DESTRUCTOR_ PTHREAD_DESTRUCTOR_ Number attempts made
ITERATIONS ITERATIONS to destroy thread-
specific data on thread exit_SC_THREAD_KEYS_MAX PTHREAD_KEYS_MAX Max number of data
keys per process_SC_THREAD_PRIO_ _POSIX_THREAD_PRIO_ Supports Priority
INHERIT INHERIT Inheritance option_SC_THREAD_PRIO_ _POSIX_THREAD_PRIO_ Supports Priority
PROTECT PROTECT Protection option_SC_THREAD_PRIORITY_ _POSIX_THREAD_PRIORITY_ Supports Thread
SCHEDULING SCHEDULING Execution Scheduling option_SC_THREAD_PROCESS_ _POSIX_THREAD_PROCESS_ Supports
SHARED SHARED Process-Shared
Synchronization option_SC_THREAD_SAFE_ _POSIX_THREAD_SAFE_ Supports Thread-Safe
FUNCTIONS FUNCTIONS Functions option_SC_THREAD_STACK_MIN PTHREAD_STACK_MIN Min byte size of
thread stack storage_SC_THREAD_THREADS_MAX PTHREAD_THREADS_MAX Max number of
threads per process_SC_THREADS _POSIX_THREADS Supports Threads
option_SC_TIMEOUTS _POSIX_TIMEOUTS Supports Timeouts
SunOS 5.11 Last change: 26 Mar 2008 5
Standard C Library Functions sysconf(3C)
option_SC_TIMER_MAX TIMER_MAX Max number of timer
per process supported_SC_TIMERS _POSIX_TIMERS Supports Timers
_SC_TTY_NAME_MAX TTYNAME_MAX Max length of tty
device name_SC_TZNAME_MAX TZNAME_MAX Max number of bytes
supported for name of a time zone_SC_V6_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 Supports X/Open
ILP32 w/32-bit
offset build environment_SC_V6_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG Supports X/Open
ILP32 w/64-bit
offset build environment_SC_V6_LP64_OFF64 _POSIX_V6_LP64_OFF64 Supports X/Open
LP64 w/64-bit
offset build environment_SC_V6_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG Same as
_SC_V6_LP64_OFF64
_SC_VERSION _POSIX_VERSION POSIX.1 version
supported_SC_XBS5_ILP32_OFF32 _XBS_ILP32_OFF32 Indicates support
for X/Open ILP32
w/32-bit offset
build environment_SC_XBS5_ILP32_OFFBIG _XBS5_ILP32_OFFBIG Indicates support
for X/Open ILP32
w/64-bit offset
build environment_SC_XBS5_LP64_OFF64 _XBS5_LP64_OFF64 Indicates support of
X/Open LP64,
64-bit offset
build environment_SC_XBS5_LPBIG_OFFBIG _XBS5_LP64_OFF64 Same as
_SC_XBS5_LP64_OFF64
_SC_XOPEN_CRYPT _XOPEN_CRYPT Supports X/Open
Encryption Feature Group_SC_XOPEN_ENH_I18N _XOPEN_ENH_I18N Supports X/Open
Enhanced Internationalization Feature Group_SC_XOPEN_LEGACY _XOPEN_LEGACY Supports X/Open
Legacy Feature Group_SC_XOPEN_REALTIME _XOPEN_REALTIME Supports X/Open
POSIX Realtime Feature GroupSunOS 5.11 Last change: 26 Mar 2008 6
Standard C Library Functions sysconf(3C)
_SC_XOPEN_REALTIME_ _XOPEN_REALTIME_THREADS Supports X/Open
THREADS POSIX Reatime Threads Feature Group_SC_XOPEN_SHM _XOPEN_SHM Supports X/Open
Shared Memory Feature Group_SC_XOPEN_STREAMS _POSIX_XOPEN_STREAMS Supports XSI Streams
option group_SC_XOPEN_UNIX _XOPEN_UNIX Supports X/Open CAE
Specification, August 1994, System Interfaces and Headers, Issue 4, Version 2_SC_XOPEN_VERSION _XOPEN_VERSION Integer value
indicates version ofX/Open Portability Guide to which implementation conforms
_SC_XOPEN_XCU_VERSION _XOPEN_XCU_VERSION Integer value
indicates version of XCU specification to which implementation conformsThe following options are not supported and return -1:
_SC_2_PBS _POSIX2_PBS
_SC_2_PBS_ACCOUNTING _POSIX2_PBS_ACCOUNTING
_SC_2_PBS_CHECKPOINT _POSIX2_PBS_CHECKPOINT
_SC_2_PBS_LOCATE _POSIX2_PBS_LOCATE
_SC_2_PBS_MESSAGE _POSIX2_PBS_MESSAGE
_SC_2_PBS_TRACK _POSIX2_PBS_TRACK
_SC_ADVISORY_INFO _POSIX_ADVISORY_INFO
_SC_CPUTIME _POSIX_CPUTIME
_SC_SPORADIC_SERVER _POSIX_SPORADIC_SERVER
_SC_SS_REPL_MAX _POSIX_SS_REPL_MAX
_SC_THREAD_CPUTIME _POSIX_THREAD_CPUTIME
_SC_THREAD_SPORADIC_SERVER _POSIX_THREAD_SPORADIC_SERVER
_SC_TRACE _POSIX_TRACE
_SC_TRACE_EVENT_FILTER _POSIX_TRACE_EVENT_FILTER
_SC_TRACE_EVENT_NAME_MAX _POSIX_TRACE_EVENT_NAME_MAX
_SC_TRACE_INHERIT _POSIX_TRACE_INHERIT
_SC_TRACE_LOG _POSIX_TRACE_LOG
_SC_TRACE_NAME_MAX _POSIX_TRACE_NAME_MAX
SunOS 5.11 Last change: 26 Mar 2008 7
Standard C Library Functions sysconf(3C)
_SC_TRACE_SYS_MAX _POSIX_TRACE_SYS_MAX
_SC_TRACE_USER_EVENT_MAX _POSIX_TRACE_USER_EVENT_MAX
_SC_TYPED_MEMORY_OBJECTS _POSIX_TYPED_MEMORY_OBJECTS
RETURN VALUES
Upon successful completion, sysconf() 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 the implementation's, or . With only a few obvious exceptions such as _SC_AVPHYS_PAGES and
_SC_NPROCESSORS_ONLN, the value will not change during the
lifetime of the calling process.If name is an invalid value, sysconf() returns -1 and sets
errno to indicate the error. If the variable correspondingto name is associated with functionality that is not sup-
ported by the system, sysconf() returns -1 without changing
the value of errno.Calling sysconf() with the following returns -1 without set-
ting errno, because no maximum limit can be determined. The system supports at least the minimum values and can support higher values depending upon system resources. Variable Minimum supported value_SC_AIO_MAX _POSIX_AIO_MAX
_SC_ATEXIT_MAX 32
_SC_MQ_OPEN_MAX 32
_SC_THREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
_SC_THREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
_SC_THREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
The following SPARC and x86 platform variables return EIN-
VAL:_SC_COHER_BLKSZ _SC_DCACHE_ASSOC
_SC_DCACHE_BLKSZ _SC_DCACHE_LINESZ
_SC_DCACHE_SZ _SC_DCACHE_TBLKSZ
_SC_ICACHE_ASSOC _SC_ICACHE_BLKSZ
_SC_ICACHE_LINESZ _SC_ICACHE_SZ
_SC_SPLIT_CACHE
ERRORS
The sysconf() function will fail if:
SunOS 5.11 Last change: 26 Mar 2008 8
Standard C Library Functions sysconf(3C)
EINVAL The value of the name argument is invalid.ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Architecture | SPARC and x86 ||_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
| MT-Level | MT-Safe, Async-Signal-Safe |
|_____________________________|_____________________________|
| Standard | See standards(5). ||_____________________________|_____________________________|
SEE ALSO
pooladm(1M), zoneadm(1M), fpathconf(2), seteuid(2), setrlimit(2), confstr(3C), attributes(5), standards(5) NOTESA call to setrlimit() can cause the value of OPEN_MAX to
change.Multiplying sysconf(_SC_PHYS_PAGES) or
sysconf(_SC_AVPHYS_PAGES) by sysconf(_SC_PAGESIZE) to deter-
mine memory amount in bytes can exceed the maximum valuesrepresentable in a 32-bit signed or unsigned integer.
The value of CLK_TCK can be variable and it should not be
assumed that CLK_TCK is a compile-time constant.
If the caller is in a non-global zone and the pools facility
is active, sysconf(_SC_NPROCESSORS_CONF) and
sysconf(_SC_NPROCESSORS_ONLN) return the number of proces-
sors in the processor set of the pool to which the zone is bound.SunOS 5.11 Last change: 26 Mar 2008 9