DragonFly On-Line Manual Pages

Search: Section:  


SYSCONF(3)            DragonFly Library Functions Manual            SYSCONF(3)

NAME

sysconf - get configurable system variables

LIBRARY

Standard C Library (libc, -lc)

SYNOPSIS

#include <unistd.h> long sysconf(int name);

DESCRIPTION

This interface is defined by IEEE Std 1003.1-1988 ("POSIX.1"). A far more complete interface is available using sysctl(3). The sysconf() function provides a method for applications to determine the current value of a configurable system limit or option variable. The name argument specifies the system variable to be queried. Symbolic constants for each name value are found in the include file <unistd.h>. The available values are as follows: _SC_ADVISORY_INFO The version of IEEE Std 1003.1 ("POSIX.1") and its Advisory Information option to which the system attempts to conform, otherwise -1. _SC_AIO_LISTIO_MAX Maximum number of I/O operations in a single list I/O call supported. _SC_AIO_MAX Maximum number of outstanding asynchronous I/O operations supported. _SC_AIO_PRIO_DELTA_MAX The maximum amount by which a process can decrease its asynchronous I/O priority level from its own scheduling priority. _SC_ASYNCHRONOUS_IO The version of IEEE Std 1003.1 ("POSIX.1") and its Asynchronous Input and Output option to which the system attempts to conform, otherwise -1. _SC_ARG_MAX The maximum bytes of argument to execve(2). _SC_ATEXIT_MAX Maximum number of functions that may be registered with atexit(). _SC_BARRIERS The version of IEEE Std 1003.1 ("POSIX.1") and its Barriers option to which the system attempts to conform, otherwise -1. _SC_BC_BASE_MAX The maximum ibase/obase values in the bc(1) utility. _SC_BC_DIM_MAX The maximum array size in the bc(1) utility. _SC_BC_SCALE_MAX The maximum scale value in the bc(1) utility. _SC_BC_STRING_MAX The maximum string length in the bc(1) utility. _SC_CHILD_MAX The maximum number of simultaneous processes per user id. _SC_CLK_TCK The frequency of the statistics clock in ticks per second. _SC_CLOCK_SELECTION Return the POSIX version the implementation of the Clock Selection Option on this system conforms to, or -1 if unavailable. _SC_COLL_WEIGHTS_MAX The maximum number of weights that can be assigned to any entry of the LC_COLLATE order keyword in the locale definition file. _SC_CPUTIME The CLOCK_PROCESS_CPUTIME_ID clock ID is supported, otherwise -1. _SC_DELAYTIMER_MAX Maximum number of timer expiration overruns. _SC_EXPR_NEST_MAX The maximum number of expressions that can be nested within parenthesis by the expr(1) utility. _SC_FSYNC Return 1 if the File Synchronization Option is available on this system, otherwise -1. _SC_GETGR_R_SIZE_MAX Suggested initial value for the size of the group entry buffer. _SC_GETPW_R_SIZE_MAX Suggested initial value for the size of the password entry buffer. _SC_HOST_NAME_MAX Maximum length of a host name (not including the terminating null) as returned from the gethostname(3), function. _SC_IOV_MAX The maximum number of elements in the I/O vector used by readv(2), writev(2), recvmsg(2), and sendmsg(2). _SC_IPV6 The version of IEEE Std 1003.1 ("POSIX.1") and its IPv6 option to which the system attempts to conform, otherwise -1. _SC_JOB_CONTROL Return 1 if job control is available on this system, otherwise -1. _SC_LINE_MAX The maximum length in bytes of a text-processing utility's input line. _SC_LOGIN_NAME_MAX Maximum length of a login name. _SC_MAPPED_FILES Return 1 if the Memory Mapped Files Option is available on this system, otherwise -1. _SC_MEMLOCK Return 1 if the Process Memory Locking Option is available on this system, otherwise -1. _SC_MEMLOCK_RANGE Return 1 if the Range Memory Locking Option is available on this system, otherwise -1. _SC_MEMORY_PROTECTION Return 1 if the Memory Protection Option is available on this system, otherwise -1. _SC_MESSAGE_PASSING Whether Message Passing option is supported. _SC_MONOTONIC_CLOCK Return the POSIX version of the implementation of the Monotonic Clock option that this system conforms to, or -1 if unavailable. _SC_MQ_OPEN_MAX The maximum number of open message queue descriptors per process. _SC_MQ_PRIO_MAX The maximum number of message priorities supported by the implementation. _SC_NGROUPS_MAX The maximum number of supplemental groups. _SC_OPEN_MAX The maximum number of open files per user id. _SC_PAGESIZE The size of a system page in bytes. _SC_PAGE_SIZE Equivalent to _SC_PAGESIZE. _SC_PRIORITIZED_IO The version of IEEE Std 1003.1 ("POSIX.1") and its Prioritized Input and Output option to which the system attempts to conform, otherwise -1. _SC_PRIORITY_SCHEDULING The version of IEEE Std 1003.1 ("POSIX.1") and its Process Scheduling option to which the system attempts to conform, otherwise -1. _SC_RAW_SOCKETS The version of IEEE Std 1003.1 ("POSIX.1") and its Raw Sockets option to which the system attempts to conform, otherwise -1. _SC_READER_WRITER_LOCKS The version of IEEE Std 1003.1 ("POSIX.1") and its Read-Write Locks option to which the system attempts to conform, otherwise -1. _SC_REALTIME_SIGNALS The version of IEEE Std 1003.1 ("POSIX.1") and its Realtime Signals Extension option to which the system attempts to conform, otherwise -1. _SC_RE_DUP_MAX The maximum number of repeated occurrences of a regular expression permitted when using interval notation. _SC_REGEXP Return 1 if the system supports regular expression handling. _SC_RTSIG_MAX Maximum number of realtime signals reserved for application use. _SC_SAVED_IDS Return 1 if saved set-group and saved set-user ID is available, otherwise -1. _SC_SEMAPHORES The version of IEEE Std 1003.1 ("POSIX.1") and its Semaphores option to which the system attempts to conform, otherwise -1. _SC_SEM_NSEMS_MAX Maximum number of semaphores that a process may have. _SC_SEM_VALUE_MAX The maximum value a semaphore may have. _SC_SHARED_MEMORY_OBJECTS The version of IEEE Std 1003.1 ("POSIX.1") and its Shared Memory Objects option to which the system attempts to conform, otherwise -1. _SC_SHELL Return 1 if the system supports the POSIX shell. _SC_SIGQUEUE_MAX Maximum number of queued signals that a process may send and have pending at the receiver(s) at any time. _SC_SPAWN The version of IEEE Std 1003.1 ("POSIX.1") and its Spawn option to which the system attempts to conform, otherwise -1. _SC_SPIN_LOCKS The version of IEEE Std 1003.1 ("POSIX.1") and its Spin Locks option to which the system attempts to conform, otherwise -1. _SC_SPORADIC_SERVER The version of IEEE Std 1003.1 ("POSIX.1") and its Process Sporadic Server option to which the system attempts to conform, otherwise -1. _SC_STREAM_MAX The maximum number of streams that a process may have open at any one time. _SC_SYMLOOP_MAX Maximum number of symbolic links that can be reliably traversed in the resolution of a pathname in the absence of a loop. _SC_SYNCHRONIZED_IO Return 1 if the Synchronized I/O Option is available on this system, otherwise -1. _SC_THREAD_ATTR_STACKADDR The version of IEEE Std 1003.1 ("POSIX.1") and its Thread Stack Address Attribute option to which the system attempts to conform, otherwise -1. _SC_THREAD_ATTR_STACKSIZE The version of IEEE Std 1003.1 ("POSIX.1") and its Thread Stack Size Attribute option to which the system attempts to conform, otherwise -1. _SC_THREAD_CPUTIME The CLOCK_THREAD_CPUTIME_ID clock ID is supported, otherwise -1. _SC_THREAD_PRIO_INHERIT The version of IEEE Std 1003.1 ("POSIX.1") and its Thread Priority Inheritance option to which the system attempts to conform, otherwise -1. _SC_THREAD_PRIO_PROTECT Whether the system supports the priority ceiling protocol for POSIX threads. _SC_THREAD_PRIORITY_SCHEDULING The version of IEEE Std 1003.1 ("POSIX.1") and its Thread Execution Scheduling option to which the system attempts to conform, otherwise -1. _SC_THREAD_PROCESS_SHARED The version of IEEE Std 1003.1 ("POSIX.1") and its Thread Process-Shared Synchronization option to which the system attempts to conform, otherwise -1. _SC_THREAD_ROBUST_PRIO_INHERIT The version of IEEE Std 1003.1 ("POSIX.1") and its Robust Mutex Priority Inheritance option to which the system attempts to conform, otherwise -1. _SC_THREAD_ROBUST_PRIO_PROTECT The version of IEEE Std 1003.1 ("POSIX.1") and its Robust Mutex Priority Protection option to which the system attempts to conform, otherwise -1. _SC_THREADS The version of IEEE Std 1003.1 ("POSIX.1") and its Threads option to which the system attempts to conform, otherwise -1. _SC_THREAD_SAFE_FUNCTIONS The level of support for thread-safe (re-entrant) functions. _SC_THREAD_SPORADIC_SERVER The version of IEEE Std 1003.1 ("POSIX.1") and its Thread Sporadic Server option to which the system attempts to conform, otherwise -1. _SC_THREAD_STACK_MIN Minimum size in bytes of thread stack storage. _SC_THREAD_THREADS_MAX Maximum number of threads that can be created per process. _SC_TIMEOUTS The version of IEEE Std 1003.1 ("POSIX.1") and its Timeouts option to which the system attempts to conform, otherwise -1. _SC_TIMER_MAX Maximum number of timers per process supported. _SC_TIMERS The version of IEEE Std 1003.1 ("POSIX.1") and its Timers option to which the system attempts to conform, otherwise -1. _SC_TTY_NAME_MAX Maximum length of terminal device name. _SC_TYPED_MEMORY_OBJECTS The version of IEEE Std 1003.1 ("POSIX.1") and its Typed Memory Objects option to which the system attempts to conform, otherwise -1. _SC_TZNAME_MAX The maximum number of bytes supported for the name of a timezone. _SC_VERSION The version of IEEE Std 1003.1 ("POSIX.1") with which the system attempts to comply. _SC_XOPEN_SHM Return 1 if the system supports the X/Open Portability Guide Issue 4, Version 2 ("XPG4.2") Shared Memory Feature for both compilation and execution, or 0 if only compilation support is guaranteed. _SC_XOPEN_VERSION An integer value greater than or equal to 4, indicating the version of the X/Open Portability Guide to which this system conforms. _SC_2_C_BIND Return 1 if the system's C-language development facilities support the C-Language Bindings Option, otherwise -1. _SC_2_C_DEV Return 1 if the system supports the C-Language Development Utilities Option, otherwise -1. _SC_2_CHAR_TERM Return 1 if the system supports at least one terminal type capable of all operations described in IEEE Std 1003.2 ("POSIX.2"), otherwise -1. _SC_2_FORT_DEV Return 1 if the system supports the FORTRAN Development Utilities Option, otherwise -1. _SC_2_FORT_RUN Return 1 if the system supports the FORTRAN Runtime Utilities Option, otherwise -1. _SC_2_LOCALEDEF Return 1 if the system supports the creation of locales, otherwise -1. _SC_2_SW_DEV Return 1 if the system supports the Software Development Utilities Option, otherwise -1. _SC_2_UPE Return 1 if the system supports the User Portability Utilities Option, otherwise -1. _SC_2_VERSION The version of IEEE Std 1003.2 ("POSIX.2") with which the system attempts to comply. These values also exist, but may not be standard: _SC_LEVEL1_DCACHE_LINESIZE Returns the L1 cache line size. _SC_NPROCESSORS_CONF The number of processors configured. _SC_NPROCESSORS_ONLN The number of processors online. _SC_PHYS_PAGES The number of pages of physical memory.

RETURN VALUES

If the call to sysconf() is not successful, -1 is returned and errno is set appropriately. Otherwise, if the variable is associated with functionality that is not supported, -1 is returned and errno is not modified. Otherwise, the current variable value is returned. Because -1 is a valid return value upon success, applications wishing to check for real error conditions should set errno to 0, then call sysconf(), and check errno if -1 is returned.

ERRORS

The sysconf() function may fail and set errno for any of the errors specified for the library function sysctl(3). In addition, the following error may be reported: [EINVAL] The value of the name argument is invalid.

SEE ALSO

getconf(1), pathconf(2), confstr(3), sysctl(3)

STANDARDS

Except for the fact that values returned by sysconf() may change over the lifetime of the calling process, this function conforms to IEEE Std 1003.1-1988 ("POSIX.1"). _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN are nonstandard, but implemented in many systems.

HISTORY

The sysconf() function first appeared in 4.4BSD. DragonFly 6.1-DEVELOPMENT August 20, 2021 DragonFly 6.1-DEVELOPMENT

Search: Section: