1.\" $NetBSD: sysconf.3,v 1.20 2002/02/08 12:12:55 kleink Exp $ 2.\" 3.\" Copyright (c) 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)sysconf.3 8.3 (Berkeley) 4/19/94 35.\" 36.Dd January 31, 2002 37.Dt SYSCONF 3 38.Os 39.Sh NAME 40.Nm sysconf 41.Nd get configurable system variables 42.Sh LIBRARY 43.Lb libc 44.Sh SYNOPSIS 45.Fd #include \*[Lt]unistd.h\*[Gt] 46.Ft long 47.Fn sysconf "int name" 48.Sh DESCRIPTION 49This interface is defined by 50.St -p1003.1-88 . 51A far more complete interface is available using 52.Xr sysctl 3 . 53.Pp 54The 55.Fn sysconf 56function provides a method for applications to determine the current 57value of a configurable system limit or option variable. 58The 59.Fa name 60argument specifies the system variable to be queried. 61Symbolic constants for each name value are found in the include file 62.Li \*[Lt]unistd.h\*[Gt] . 63.Pp 64The available values are as follows: 65.Pp 66.Bl -tag -width "123456" 67.Pp 68.It Li _SC_ARG_MAX 69The maximum bytes of argument to 70.Xr execve 2 . 71.It Li _SC_CHILD_MAX 72The maximum number of simultaneous processes per user id. 73.It Li _SC_CLK_TCK 74The number of clock ticks per second. 75.It Li _SC_FSYNC 76Return 1 if the File Synchronization Option is available on this system, 77otherwise \-1. 78.It Li _SC_IOV_MAX 79The maximum number of 80.Va iovec 81structures that a process has available for use with 82.Xr preadv 2 , 83.Xr pwritev 2 , 84.Xr readv 2 , 85.Xr recvmsg 2 , 86.Xr sendmsg 2 87or 88.Xr writev 2 . 89.It Li _SC_JOB_CONTROL 90Return 1 if job control is available on this system, otherwise \-1. 91.It Li _SC_LOGIN_NAME_MAX 92Returns the size of the storage required for a login name, in bytes, 93including the terminating NUL. 94.It Li _SC_MAPPED_FILES 95Return 1 if the Memory Mapped Files Option is available on this system, 96otherwise \-1. 97.It Li _SC_MEMLOCK 98Return 1 if the Process Memory Locking Option is available on this system, 99otherwise \-1. 100.It Li _SC_MEMLOCK_RANGE 101Return 1 if the Range Memory Locking Option is available on this system, 102otherwise \-1. 103.It Li _SC_MEMORY_PROTECTION 104Return 1 if the Memory Protection Option is available on this system, 105otherwise \-1. 106.It Li _SC_MONOTONIC_CLOCK 107Return the 108.Tn POSIX 109version the implementation of the Monotonic Clock Option 110on this system conforms to, 111or \-1 if unavailable. 112.It Li _SC_NGROUPS_MAX 113The maximum number of supplemental groups. 114.It Li _SC_OPEN_MAX 115The maximum number of open files per process. 116.It Li _SC_PAGESIZE 117The size of a system page in bytes. 118.It Li _SC_STREAM_MAX 119The minimum maximum number of streams that a process may have open 120at any one time. 121.It Li _SC_SYNCHRONIZED_IO 122Return 1 if the Synchronized I/O Option is available on this system, 123otherwise \-1. 124.It Li _SC_TZNAME_MAX 125The minimum maximum number of types supported for the name of a 126timezone. 127.It Li _SC_SAVED_IDS 128Returns 1 if saved set-group and saved set-user ID is available, 129otherwise \-1. 130.It Li _SC_VERSION 131The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 132attempts to comply. 133.It Li _SC_XOPEN_SHM 134Return 1 of the system supports System V style shared memory, 135otherwise \-1. 136.It Li _SC_BC_BASE_MAX 137The maximum ibase/obase values in the 138.Xr bc 1 139utility. 140.It Li _SC_BC_DIM_MAX 141The maximum array size in the 142.Xr bc 1 143utility. 144.It Li _SC_BC_SCALE_MAX 145The maximum scale value in the 146.Xr bc 1 147utility. 148.It Li _SC_BC_STRING_MAX 149The maximum string length in the 150.Xr bc 1 151utility. 152.It Li _SC_COLL_WEIGHTS_MAX 153The maximum number of weights that can be assigned to any entry of 154the LC_COLLATE order keyword in the locale definition file. 155.It Li _SC_EXPR_NEST_MAX 156The maximum number of expressions that can be nested within 157parenthesis by the 158.Xr expr 1 159utility. 160.It Li _SC_LINE_MAX 161The maximum length in bytes of a text-processing utility's input 162line. 163.It Li _SC_RE_DUP_MAX 164The maximum number of repeated occurrences of a regular expression 165permitted when using interval notation. 166.It Li _SC_2_VERSION 167The version of POSIX 1003.2 with which the system attempts to comply. 168.It Li _SC_2_C_BIND 169Return 1 if the system's C-language development facilities support the 170C-Language Bindings Option, otherwise \-1. 171.It Li _SC_2_C_DEV 172Return 1 if the system supports the C-Language Development Utilities Option, 173otherwise \-1. 174.It Li _SC_2_CHAR_TERM 175Return 1 if the system supports at least one terminal type capable of 176all operations described in POSIX 1003.2, otherwise \-1. 177.It Li _SC_2_FORT_DEV 178Return 1 if the system supports the FORTRAN Development Utilities Option, 179otherwise \-1. 180.It Li _SC_2_FORT_RUN 181Return 1 if the system supports the FORTRAN Runtime Utilities Option, 182otherwise \-1. 183.It Li _SC_2_LOCALEDEF 184Return 1 if the system supports the creation of locales, otherwise \-1. 185.It Li _SC_2_SW_DEV 186Return 1 if the system supports the Software Development Utilities Option, 187otherwise \-1. 188.It Li _SC_2_UPE 189Return 1 if the system supports the User Portability Utilities Option, 190otherwise \-1. 191.El 192.Sh RETURN VALUES 193If the call to 194.Nm sysconf 195is not successful, \-1 is returned and 196.Va errno 197is set appropriately. 198Otherwise, if the variable is associated with functionality that is not 199supported, \-1 is returned and 200.Va errno 201is not modified. 202Otherwise, the current variable value is returned. 203.Sh ERRORS 204The 205.Fn sysconf 206function may fail and set 207.Va errno 208for any of the errors specified for the library functions 209.Xr sysctl 3 . 210In addition, the following error may be reported: 211.Bl -tag -width Er 212.It Bq Er EINVAL 213The value of the 214.Fa name 215argument is invalid. 216.El 217.Sh SEE ALSO 218.Xr sysctl 3 219.Sh STANDARDS 220The 221.Fn sysconf 222function conforms to 223.St -p1003.1-90 . 224.Sh HISTORY 225The 226.Nm sysconf 227function first appeared in 228.Bx 4.4 . 229.Sh BUGS 230The value for _SC_STREAM_MAX is a minimum maximum, and required to be 231the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously 232small and misleading number. 233