OpenBSD manual page server

Manual Page Search Parameters

SYSCONF(3) Library Functions Manual SYSCONF(3)

sysconfget configurable system variables

library “libc”

#include <unistd.h>

long
sysconf(int name);

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:

The maximum bytes of argument to execve(2).
The maximum number of functions that may be registered with atexit(3).
The version of IEEE Std 1003.1 (“POSIX.1”) and its Barriers option to which the system attempts to conform, otherwise -1.
Return the POSIX version the implementation of the Clock Selection Option on this system conforms to, or -1 if unavailable.
The maximum number of simultaneous processes per user id.
The number of clock ticks per second.
Return 1 if the File Synchronization Option is available on this system, otherwise -1.
The maximum size of a hostname, including NULL.
The maximum number of iovec structures that a process has available for use with preadv(2), pwritev(2), readv(2), recvmsg(2), sendmsg(2) or writev(2).
Return 1 if job control is available on this system, otherwise -1.
Returns the size of the storage required for a login name, in bytes, including the terminating NUL.
Return 1 if the Memory Mapped Files Option is available on this system, otherwise -1.
Return 1 if the Process Memory Locking Option is available on this system, otherwise -1.
Return 1 if the Range Memory Locking Option is available on this system, otherwise -1.
Return 1 if the Memory Protection Option is available on this system, otherwise -1.
Return the POSIX version the implementation of the Monotonic Clock Option on this system conforms to, or -1 if unavailable.
The maximum number of supplemental groups.
The maximum number of open files per process.
The size of a system page in bytes.
The maximum length of the password, not counting NULL.
The version of IEEE Std 1003.1 (“POSIX.1”) and its Read-Write Locks option to which the system attempts to conform, otherwise -1.
Return 1 if POSIX regular expressions are available on this system, otherwise -1.
The version of IEEE Std 1003.1 (“POSIX.1”) and its Semaphores option to which the system attempts to conform, otherwise -1.

Availability of the Semaphores option depends on the P1003_1B_SEMAPHORE kernel option.

Return 1 if POSIX shell is available on this system, otherwise -1.
The version of IEEE Std 1003.1 (“POSIX.1”) and its Spin Locks option to which the system attempts to conform, otherwise -1.
The minimum maximum number of streams that a process may have open at any one time.
The maximum number of symbolic links that may be expanded in a path name.
Return 1 if the Synchronized I/O Option is available on this system, otherwise -1.
The version of IEEE Std 1003.1 (“POSIX.1”) and its Threads option to which the system attempts to conform, otherwise -1.
The version of IEEE Std 1003.1 (“POSIX.1”) and its Timers option to which the system attempts to conform, otherwise -1.
The minimum maximum number of types supported for the name of a timezone.
Returns 1 if saved set-group and saved set-user ID is available, otherwise -1.
The version of ISO/IEC 9945 (POSIX 1003.1) with which the system attempts to comply.
Return 1 if the X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”) Shared Memory option is available on this system, otherwise -1.

Availability of the Shared Memory option depends on the SYSVSHM kernel option.

The maximum ibase/obase values in the bc(1) utility.
The maximum array size in the bc(1) utility.
The maximum scale value in the bc(1) utility.
The maximum string length in the bc(1) utility.
The maximum number of weights that can be assigned to any entry of the LC_COLLATE order keyword in the locale definition file.
The maximum number of expressions that can be nested within parenthesis by the expr(1) utility.
The maximum length in bytes of a text-processing utility's input line.
The maximum number of repeated occurrences of a regular expression permitted when using interval notation.
The version of POSIX 1003.2 with which the system attempts to comply.
Return 1 if the system's C-language development facilities support the C-Language Bindings Option, otherwise -1.
Return 1 if the system supports the C-Language Development Utilities Option, otherwise -1.
Return 1 if the system supports at least one terminal type capable of all operations described in POSIX 1003.2, otherwise -1.
Return 1 if the system supports the FORTRAN Development Utilities Option, otherwise -1.
Return 1 if the system supports the FORTRAN Runtime Utilities Option, otherwise -1.
Return 1 if the system supports the creation of locales, otherwise -1.
Return 1 if the system supports the Software Development Utilities Option, otherwise -1.
Return 1 if the system supports the User Portability Utilities Option, otherwise -1.
The minimum size of the buffer passed to getgrgid_r(3) and getgrnam_r(3).
The minimum size of the buffer passed to getpwnam_r(3) and getpwuid_r(3).
The number of processors configured.
The number of processors online (capable of running processes).
The amount of physical memory on the system in _SC_PAGESIZE bytes.

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.

The sysconf() function may fail and set errno for any of the errors specified for the library functions sysctl(3). In addition, the following error may be reported:

[]
The value of the name argument is invalid.

getconf(1), limits(3), sysctl(3)

The sysconf() function conforms to IEEE Std 1003.1-1990 (“POSIX.1”). The constants _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN are not part of the standard, but are provided by many systems.

The sysconf function first appeared in 4.4BSD.

The value for _SC_STREAM_MAX is a minimum maximum, and required to be the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously small and misleading number.

November 2, 2012 NetBSD-7.0.1