1*0a6a1f1dSLionel Sambuc.\" $NetBSD: sysconf.3,v 1.44 2015/08/20 11:05:39 wiz Exp $ 22fe8fb19SBen Gras.\" 32fe8fb19SBen Gras.\" Copyright (c) 1993 42fe8fb19SBen Gras.\" The Regents of the University of California. All rights reserved. 52fe8fb19SBen Gras.\" 62fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without 72fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions 82fe8fb19SBen Gras.\" are met: 92fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright 102fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer. 112fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 122fe8fb19SBen Gras.\" notice, this list of conditions and the following disclaimer in the 132fe8fb19SBen Gras.\" documentation and/or other materials provided with the distribution. 142fe8fb19SBen Gras.\" 3. Neither the name of the University nor the names of its contributors 152fe8fb19SBen Gras.\" may be used to endorse or promote products derived from this software 162fe8fb19SBen Gras.\" without specific prior written permission. 172fe8fb19SBen Gras.\" 182fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 192fe8fb19SBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 202fe8fb19SBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 212fe8fb19SBen Gras.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 222fe8fb19SBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 232fe8fb19SBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 242fe8fb19SBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 252fe8fb19SBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 262fe8fb19SBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 272fe8fb19SBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 282fe8fb19SBen Gras.\" SUCH DAMAGE. 292fe8fb19SBen Gras.\" 302fe8fb19SBen Gras.\" @(#)sysconf.3 8.3 (Berkeley) 4/19/94 312fe8fb19SBen Gras.\" 32*0a6a1f1dSLionel Sambuc.Dd August 20, 2015 332fe8fb19SBen Gras.Dt SYSCONF 3 342fe8fb19SBen Gras.Os 352fe8fb19SBen Gras.Sh NAME 362fe8fb19SBen Gras.Nm sysconf 372fe8fb19SBen Gras.Nd get configurable system variables 382fe8fb19SBen Gras.Sh LIBRARY 392fe8fb19SBen Gras.Lb libc 402fe8fb19SBen Gras.Sh SYNOPSIS 412fe8fb19SBen Gras.In unistd.h 422fe8fb19SBen Gras.Ft long 432fe8fb19SBen Gras.Fn sysconf "int name" 442fe8fb19SBen Gras.Sh DESCRIPTION 452fe8fb19SBen GrasThis interface is defined by 462fe8fb19SBen Gras.St -p1003.1-88 . 472fe8fb19SBen GrasA far more complete interface is available using 482fe8fb19SBen Gras.Xr sysctl 3 . 492fe8fb19SBen Gras.Pp 502fe8fb19SBen GrasThe 512fe8fb19SBen Gras.Fn sysconf 522fe8fb19SBen Grasfunction provides a method for applications to determine the current 532fe8fb19SBen Grasvalue of a configurable system limit or option variable. 542fe8fb19SBen GrasThe 552fe8fb19SBen Gras.Fa name 562fe8fb19SBen Grasargument specifies the system variable to be queried. 572fe8fb19SBen GrasSymbolic constants for each name value are found in the include file 582fe8fb19SBen Gras.In unistd.h . 592fe8fb19SBen Gras.Pp 602fe8fb19SBen GrasThe available values are as follows: 612fe8fb19SBen Gras.Bl -tag -width "123456" 622fe8fb19SBen Gras.It Li _SC_ARG_MAX 632fe8fb19SBen GrasThe maximum bytes of argument to 642fe8fb19SBen Gras.Xr execve 2 . 652fe8fb19SBen Gras.It Li _SC_ATEXIT_MAX 66f14fb602SLionel SambucThe maximum number of functions that may be registered with 672fe8fb19SBen Gras.Xr atexit 3 . 682fe8fb19SBen Gras.It Li _SC_BARRIERS 692fe8fb19SBen GrasThe version of 702fe8fb19SBen Gras.St -p1003.1 712fe8fb19SBen Grasand its 722fe8fb19SBen GrasBarriers 732fe8fb19SBen Grasoption to which the system attempts to conform, 742fe8fb19SBen Grasotherwise \-1. 752fe8fb19SBen Gras.It Li _SC_CLOCK_SELECTION 762fe8fb19SBen GrasReturn the 772fe8fb19SBen Gras.Tn POSIX 782fe8fb19SBen Grasversion the implementation of the Clock Selection Option 792fe8fb19SBen Grason this system conforms to, 802fe8fb19SBen Grasor \-1 if unavailable. 812fe8fb19SBen Gras.It Li _SC_CHILD_MAX 822fe8fb19SBen GrasThe maximum number of simultaneous processes per user id. 832fe8fb19SBen Gras.It Li _SC_CLK_TCK 842fe8fb19SBen GrasThe number of clock ticks per second. 852fe8fb19SBen Gras.It Li _SC_FSYNC 862fe8fb19SBen GrasReturn 1 if the File Synchronization Option is available on this system, 872fe8fb19SBen Grasotherwise \-1. 882fe8fb19SBen Gras.It Li _SC_HOST_NAME_MAX 89f14fb602SLionel SambucThe maximum size of a hostname, including 90f14fb602SLionel Sambuc.Dv NULL . 912fe8fb19SBen Gras.It Li _SC_IOV_MAX 922fe8fb19SBen GrasThe maximum number of 932fe8fb19SBen Gras.Va iovec 942fe8fb19SBen Grasstructures that a process has available for use with 952fe8fb19SBen Gras.Xr preadv 2 , 962fe8fb19SBen Gras.Xr pwritev 2 , 972fe8fb19SBen Gras.Xr readv 2 , 982fe8fb19SBen Gras.Xr recvmsg 2 , 992fe8fb19SBen Gras.Xr sendmsg 2 1002fe8fb19SBen Grasor 1012fe8fb19SBen Gras.Xr writev 2 . 1022fe8fb19SBen Gras.It Li _SC_JOB_CONTROL 1032fe8fb19SBen GrasReturn 1 if job control is available on this system, otherwise \-1. 1042fe8fb19SBen Gras.It Li _SC_LOGIN_NAME_MAX 1052fe8fb19SBen GrasReturns the size of the storage required for a login name, in bytes, 1062fe8fb19SBen Grasincluding the terminating NUL. 1072fe8fb19SBen Gras.It Li _SC_MAPPED_FILES 1082fe8fb19SBen GrasReturn 1 if the Memory Mapped Files Option is available on this system, 1092fe8fb19SBen Grasotherwise \-1. 1102fe8fb19SBen Gras.It Li _SC_MEMLOCK 1112fe8fb19SBen GrasReturn 1 if the Process Memory Locking Option is available on this system, 1122fe8fb19SBen Grasotherwise \-1. 1132fe8fb19SBen Gras.It Li _SC_MEMLOCK_RANGE 1142fe8fb19SBen GrasReturn 1 if the Range Memory Locking Option is available on this system, 1152fe8fb19SBen Grasotherwise \-1. 1162fe8fb19SBen Gras.It Li _SC_MEMORY_PROTECTION 1172fe8fb19SBen GrasReturn 1 if the Memory Protection Option is available on this system, 1182fe8fb19SBen Grasotherwise \-1. 1192fe8fb19SBen Gras.It Li _SC_MONOTONIC_CLOCK 1202fe8fb19SBen GrasReturn the 1212fe8fb19SBen Gras.Tn POSIX 1222fe8fb19SBen Grasversion the implementation of the Monotonic Clock Option 1232fe8fb19SBen Grason this system conforms to, 1242fe8fb19SBen Grasor \-1 if unavailable. 1252fe8fb19SBen Gras.It Li _SC_NGROUPS_MAX 1262fe8fb19SBen GrasThe maximum number of supplemental groups. 1272fe8fb19SBen Gras.It Li _SC_OPEN_MAX 1282fe8fb19SBen GrasThe maximum number of open files per process. 1292fe8fb19SBen Gras.It Li _SC_PAGESIZE 1302fe8fb19SBen GrasThe size of a system page in bytes. 1312fe8fb19SBen Gras.It Li _SC_PASS_MAX 132f14fb602SLionel SambucThe maximum length of the password, not counting 133f14fb602SLionel Sambuc.Dv NULL . 1342fe8fb19SBen Gras.It Li _SC_READER_WRITER_LOCKS 1352fe8fb19SBen GrasThe version of 1362fe8fb19SBen Gras.St -p1003.1 1372fe8fb19SBen Grasand its 1382fe8fb19SBen GrasRead-Write Locks 1392fe8fb19SBen Grasoption to which the system attempts to conform, 1402fe8fb19SBen Grasotherwise \-1. 1412fe8fb19SBen Gras.It Li _SC_REGEXP 1422fe8fb19SBen GrasReturn 1 if 1432fe8fb19SBen Gras.Tn POSIX 1442fe8fb19SBen Grasregular expressions are available on this system, otherwise \-1. 1452fe8fb19SBen Gras.It Li _SC_SEMAPHORES 1462fe8fb19SBen GrasThe version of 1472fe8fb19SBen Gras.St -p1003.1 1482fe8fb19SBen Grasand its 1492fe8fb19SBen GrasSemaphores 1502fe8fb19SBen Grasoption to which the system attempts to conform, 1512fe8fb19SBen Grasotherwise \-1. 1522fe8fb19SBen Gras.It Li _SC_SHELL 1532fe8fb19SBen GrasReturn 1 if 1542fe8fb19SBen Gras.Tn POSIX 1552fe8fb19SBen Grasshell is available on this system, otherwise \-1. 1562fe8fb19SBen Gras.It Li _SC_SPIN_LOCKS 1572fe8fb19SBen GrasThe version of 1582fe8fb19SBen Gras.St -p1003.1 1592fe8fb19SBen Grasand its 1602fe8fb19SBen GrasSpin Locks 1612fe8fb19SBen Grasoption to which the system attempts to conform, 1622fe8fb19SBen Grasotherwise \-1. 1632fe8fb19SBen Gras.It Li _SC_STREAM_MAX 1642fe8fb19SBen GrasThe minimum maximum number of streams that a process may have open 1652fe8fb19SBen Grasat any one time. 1662fe8fb19SBen Gras.It Li _SC_SYMLOOP_MAX 1672fe8fb19SBen GrasThe maximum number of symbolic links that may be expanded in a path name. 1682fe8fb19SBen Gras.It Li _SC_SYNCHRONIZED_IO 1692fe8fb19SBen GrasReturn 1 if the Synchronized I/O Option is available on this system, 1702fe8fb19SBen Grasotherwise \-1. 1712fe8fb19SBen Gras.It Li _SC_THREADS 1722fe8fb19SBen GrasThe version of 1732fe8fb19SBen Gras.St -p1003.1 1742fe8fb19SBen Grasand its 1752fe8fb19SBen GrasThreads 1762fe8fb19SBen Grasoption to which the system attempts to conform, 1772fe8fb19SBen Grasotherwise \-1. 1782fe8fb19SBen Gras.It Li _SC_TIMERS 1792fe8fb19SBen GrasThe version of 1802fe8fb19SBen Gras.St -p1003.1 1812fe8fb19SBen Grasand its 1822fe8fb19SBen GrasTimers 1832fe8fb19SBen Grasoption to which the system attempts to conform, 1842fe8fb19SBen Grasotherwise \-1. 1852fe8fb19SBen Gras.It Li _SC_TZNAME_MAX 1862fe8fb19SBen GrasThe minimum maximum number of types supported for the name of a 1872fe8fb19SBen Grastimezone. 1882fe8fb19SBen Gras.It Li _SC_SAVED_IDS 1892fe8fb19SBen GrasReturns 1 if saved set-group and saved set-user ID is available, 1902fe8fb19SBen Grasotherwise \-1. 1912fe8fb19SBen Gras.It Li _SC_VERSION 1922fe8fb19SBen GrasThe version of ISO/IEC 9945 (POSIX 1003.1) with which the system 1932fe8fb19SBen Grasattempts to comply. 1942fe8fb19SBen Gras.It Li _SC_XOPEN_SHM 1952fe8fb19SBen GrasReturn 1 if the 1962fe8fb19SBen Gras.St -xpg4.2 1972fe8fb19SBen GrasShared Memory 1982fe8fb19SBen Grasoption is available on this system, 1992fe8fb19SBen Grasotherwise \-1. 2002fe8fb19SBen Gras.Pp 2012fe8fb19SBen GrasAvailability of the 2022fe8fb19SBen GrasShared Memory 2032fe8fb19SBen Grasoption depends on the 2042fe8fb19SBen Gras.Li SYSVSHM 2052fe8fb19SBen Graskernel option. 2062fe8fb19SBen Gras.It Li _SC_BC_BASE_MAX 2072fe8fb19SBen GrasThe maximum ibase/obase values in the 2082fe8fb19SBen Gras.Xr bc 1 2092fe8fb19SBen Grasutility. 2102fe8fb19SBen Gras.It Li _SC_BC_DIM_MAX 2112fe8fb19SBen GrasThe maximum array size in the 2122fe8fb19SBen Gras.Xr bc 1 2132fe8fb19SBen Grasutility. 2142fe8fb19SBen Gras.It Li _SC_BC_SCALE_MAX 2152fe8fb19SBen GrasThe maximum scale value in the 2162fe8fb19SBen Gras.Xr bc 1 2172fe8fb19SBen Grasutility. 2182fe8fb19SBen Gras.It Li _SC_BC_STRING_MAX 2192fe8fb19SBen GrasThe maximum string length in the 2202fe8fb19SBen Gras.Xr bc 1 2212fe8fb19SBen Grasutility. 2222fe8fb19SBen Gras.It Li _SC_COLL_WEIGHTS_MAX 2232fe8fb19SBen GrasThe maximum number of weights that can be assigned to any entry of 2242fe8fb19SBen Grasthe LC_COLLATE order keyword in the locale definition file. 2252fe8fb19SBen Gras.It Li _SC_EXPR_NEST_MAX 2262fe8fb19SBen GrasThe maximum number of expressions that can be nested within 2272fe8fb19SBen Grasparenthesis by the 2282fe8fb19SBen Gras.Xr expr 1 2292fe8fb19SBen Grasutility. 2302fe8fb19SBen Gras.It Li _SC_LINE_MAX 2312fe8fb19SBen GrasThe maximum length in bytes of a text-processing utility's input 2322fe8fb19SBen Grasline. 2332fe8fb19SBen Gras.It Li _SC_RE_DUP_MAX 2342fe8fb19SBen GrasThe maximum number of repeated occurrences of a regular expression 2352fe8fb19SBen Graspermitted when using interval notation. 2362fe8fb19SBen Gras.It Li _SC_2_VERSION 2372fe8fb19SBen GrasThe version of POSIX 1003.2 with which the system attempts to comply. 2382fe8fb19SBen Gras.It Li _SC_2_C_BIND 2392fe8fb19SBen GrasReturn 1 if the system's C-language development facilities support the 2402fe8fb19SBen GrasC-Language Bindings Option, otherwise \-1. 2412fe8fb19SBen Gras.It Li _SC_2_C_DEV 2422fe8fb19SBen GrasReturn 1 if the system supports the C-Language Development Utilities Option, 2432fe8fb19SBen Grasotherwise \-1. 2442fe8fb19SBen Gras.It Li _SC_2_CHAR_TERM 2452fe8fb19SBen GrasReturn 1 if the system supports at least one terminal type capable of 2462fe8fb19SBen Grasall operations described in POSIX 1003.2, otherwise \-1. 2472fe8fb19SBen Gras.It Li _SC_2_FORT_DEV 2482fe8fb19SBen GrasReturn 1 if the system supports the FORTRAN Development Utilities Option, 2492fe8fb19SBen Grasotherwise \-1. 2502fe8fb19SBen Gras.It Li _SC_2_FORT_RUN 2512fe8fb19SBen GrasReturn 1 if the system supports the FORTRAN Runtime Utilities Option, 2522fe8fb19SBen Grasotherwise \-1. 2532fe8fb19SBen Gras.It Li _SC_2_LOCALEDEF 2542fe8fb19SBen GrasReturn 1 if the system supports the creation of locales, otherwise \-1. 2552fe8fb19SBen Gras.It Li _SC_2_SW_DEV 2562fe8fb19SBen GrasReturn 1 if the system supports the Software Development Utilities Option, 2572fe8fb19SBen Grasotherwise \-1. 2582fe8fb19SBen Gras.It Li _SC_2_UPE 2592fe8fb19SBen GrasReturn 1 if the system supports the User Portability Utilities Option, 2602fe8fb19SBen Grasotherwise \-1. 2612fe8fb19SBen Gras.It Li _SC_GETGR_R_SIZE_MAX 2622fe8fb19SBen GrasThe minimum size of the 2632fe8fb19SBen Gras.Fa buffer 2642fe8fb19SBen Graspassed to 2652fe8fb19SBen Gras.Xr getgrgid_r 3 2662fe8fb19SBen Grasand 2672fe8fb19SBen Gras.Xr getgrnam_r 3 . 2682fe8fb19SBen Gras.It Li _SC_GETPW_R_SIZE_MAX 2692fe8fb19SBen GrasThe minimum size of the 2702fe8fb19SBen Gras.Fa buffer 2712fe8fb19SBen Graspassed to 2722fe8fb19SBen Gras.Xr getpwnam_r 3 2732fe8fb19SBen Grasand 2742fe8fb19SBen Gras.Xr getpwuid_r 3 . 2752fe8fb19SBen Gras.It Li _SC_NPROCESSORS_CONF 2762fe8fb19SBen GrasThe number of processors configured. 2772fe8fb19SBen Gras.It Li _SC_NPROCESSORS_ONLN 2782fe8fb19SBen GrasThe number of processors online (capable of running processes). 27984d9c625SLionel Sambuc.It Li _SC_PHYS_PAGES 28084d9c625SLionel SambucThe amount of physical memory on the system in 28184d9c625SLionel Sambuc.Li _SC_PAGESIZE 28284d9c625SLionel Sambucbytes. 2832fe8fb19SBen Gras.El 2842fe8fb19SBen Gras.Sh RETURN VALUES 2852fe8fb19SBen GrasIf the call to 2862fe8fb19SBen Gras.Nm sysconf 2872fe8fb19SBen Grasis not successful, \-1 is returned and 2882fe8fb19SBen Gras.Va errno 2892fe8fb19SBen Grasis set appropriately. 2902fe8fb19SBen GrasOtherwise, if the variable is associated with functionality that is not 2912fe8fb19SBen Grassupported, \-1 is returned and 2922fe8fb19SBen Gras.Va errno 2932fe8fb19SBen Grasis not modified. 2942fe8fb19SBen GrasOtherwise, the current variable value is returned. 2952fe8fb19SBen Gras.Sh ERRORS 2962fe8fb19SBen GrasThe 2972fe8fb19SBen Gras.Fn sysconf 2982fe8fb19SBen Grasfunction may fail and set 2992fe8fb19SBen Gras.Va errno 3002fe8fb19SBen Grasfor any of the errors specified for the library functions 3012fe8fb19SBen Gras.Xr sysctl 3 . 3022fe8fb19SBen GrasIn addition, the following error may be reported: 3032fe8fb19SBen Gras.Bl -tag -width Er 3042fe8fb19SBen Gras.It Bq Er EINVAL 3052fe8fb19SBen GrasThe value of the 3062fe8fb19SBen Gras.Fa name 3072fe8fb19SBen Grasargument is invalid. 3082fe8fb19SBen Gras.El 3092fe8fb19SBen Gras.Sh SEE ALSO 310f14fb602SLionel Sambuc.Xr getconf 1 , 311f14fb602SLionel Sambuc.Xr limits 3 , 3122fe8fb19SBen Gras.Xr sysctl 3 3132fe8fb19SBen Gras.Sh STANDARDS 3142fe8fb19SBen GrasThe 3152fe8fb19SBen Gras.Fn sysconf 3162fe8fb19SBen Grasfunction conforms to 3172fe8fb19SBen Gras.St -p1003.1-90 . 3182fe8fb19SBen GrasThe constants 3192fe8fb19SBen Gras.Li _SC_NPROCESSORS_CONF 3202fe8fb19SBen Grasand 3212fe8fb19SBen Gras.Li _SC_NPROCESSORS_ONLN 3222fe8fb19SBen Grasare not part of the standard, but are provided by many systems. 3232fe8fb19SBen Gras.Sh HISTORY 3242fe8fb19SBen GrasThe 3252fe8fb19SBen Gras.Nm sysconf 3262fe8fb19SBen Grasfunction first appeared in 3272fe8fb19SBen Gras.Bx 4.4 . 3282fe8fb19SBen Gras.Sh BUGS 3292fe8fb19SBen GrasThe value for _SC_STREAM_MAX is a minimum maximum, and required to be 3302fe8fb19SBen Grasthe same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously 3312fe8fb19SBen Grassmall and misleading number. 332