1.\" $NetBSD: sysconf.3,v 1.15 2000/08/29 06:38:23 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 June 24, 1999 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 <unistd.h> 46.Ft long 47.Fn sysconf "int name" 48.Sh DESCRIPTION 49.Pp 50This interface is defined by 51.St -p1003.1-88 . 52A far more complete interface is available using 53.Xr sysctl 3 . 54.Pp 55The 56.Fn sysconf 57function provides a method for applications to determine the current 58value of a configurable system limit or option variable. 59The 60.Fa name 61argument specifies the system variable to be queried. 62Symbolic constants for each name value are found in the include file 63.Li <unistd.h> . 64.Pp 65The available values are as follows: 66.Pp 67.Bl -tag -width "123456" 68.Pp 69.It Li _SC_ARG_MAX 70The maximum bytes of argument to 71.Xr execve 2 . 72.It Li _SC_CHILD_MAX 73The maximum number of simultaneous processes per user id. 74.It Li _SC_CLK_TCK 75The number of clock ticks per second. 76.It Li _SC_FSYNC 77Return 1 if the File Synchronization Option is available on this system, 78otherwise \-1. 79.It Li _SC_IOV_MAX 80The maximum number of 81.Va iovec 82structures that a process has available for use with 83.Xr preadv 2 , 84.Xr pwritev 2 , 85.Xr readv 2 , 86.Xr recvmsg 2 , 87.Xr sendmsg 2 88or 89.Xr writev 2 . 90.It Li _SC_JOB_CONTROL 91Return 1 if job control is available on this system, otherwise \-1. 92.It Li _SC_LOGIN_NAME_MAX 93Returns the size of the storage required for a login name, in bytes, 94including the terminating NUL. 95.It Li _SC_MAPPED_FILES 96Return 1 if the Memory Mapped Files Option is available on this system, 97otherwise \-1. 98.It Li _SC_MEMLOCK 99Return 1 if the Process Memory Locking Option is available on this system, 100otherwise \-1. 101.It Li _SC_MEMLOCK_RANGE 102Return 1 if the Range Memory Locking Option is available on this system, 103otherwise \-1. 104.It Li _SC_MEMORY_PROTECTION 105Return 1 if the Memory Protection Option is available on this system, 106otherwise \-1. 107.It Li _SC_NGROUPS_MAX 108The maximum number of supplemental groups. 109.It Li _SC_OPEN_MAX 110The maximum number of open files per process. 111.It Li _SC_PAGESIZE 112The size of a system page in bytes. 113.It Li _SC_STREAM_MAX 114The minimum maximum number of streams that a process may have open 115at any one time. 116.It Li _SC_SYNCHRONIZED_IO 117Return 1 if the Synchronized I/O Option is available on this system, 118otherwise \-1. 119.It Li _SC_TZNAME_MAX 120The minimum maximum number of types supported for the name of a 121timezone. 122.It Li _SC_SAVED_IDS 123Returns 1 if saved set-group and saved set-user ID is available, 124otherwise \-1. 125.It Li _SC_VERSION 126The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 127attempts to comply. 128.It Li _SC_XOPEN_SHM 129Return 1 of the system supports System V style shared memory, 130otherwise \-1. 131.It Li _SC_BC_BASE_MAX 132The maximum ibase/obase values in the 133.Xr bc 1 134utility. 135.It Li _SC_BC_DIM_MAX 136The maximum array size in the 137.Xr bc 1 138utility. 139.It Li _SC_BC_SCALE_MAX 140The maximum scale value in the 141.Xr bc 1 142utility. 143.It Li _SC_BC_STRING_MAX 144The maximum string length in the 145.Xr bc 1 146utility. 147.It Li _SC_COLL_WEIGHTS_MAX 148The maximum number of weights that can be assigned to any entry of 149the LC_COLLATE order keyword in the locale definition file. 150.It Li _SC_EXPR_NEST_MAX 151The maximum number of expressions that can be nested within 152parenthesis by the 153.Xr expr 1 154utility. 155.It Li _SC_LINE_MAX 156The maximum length in bytes of a text-processing utility's input 157line. 158.It Li _SC_RE_DUP_MAX 159The maximum number of repeated occurrences of a regular expression 160permitted when using interval notation. 161.It Li _SC_2_VERSION 162The version of POSIX 1003.2 with which the system attempts to comply. 163.It Li _SC_2_C_BIND 164Return 1 if the system's C-language development facilities support the 165C-Language Bindings Option, otherwise \-1. 166.It Li _SC_2_C_DEV 167Return 1 if the system supports the C-Language Development Utilities Option, 168otherwise \-1. 169.It Li _SC_2_CHAR_TERM 170Return 1 if the system supports at least one terminal type capable of 171all operations described in POSIX 1003.2, otherwise \-1. 172.It Li _SC_2_FORT_DEV 173Return 1 if the system supports the FORTRAN Development Utilities Option, 174otherwise \-1. 175.It Li _SC_2_FORT_RUN 176Return 1 if the system supports the FORTRAN Runtime Utilities Option, 177otherwise \-1. 178.It Li _SC_2_LOCALEDEF 179Return 1 if the system supports the creation of locales, otherwise \-1. 180.It Li _SC_2_SW_DEV 181Return 1 if the system supports the Software Development Utilities Option, 182otherwise \-1. 183.It Li _SC_2_UPE 184Return 1 if the system supports the User Portability Utilities Option, 185otherwise \-1. 186.El 187.Sh RETURN VALUES 188If the call to 189.Nm sysconf 190is not successful, \-1 is returned and 191.Va errno 192is set appropriately. 193Otherwise, if the variable is associated with functionality that is not 194supported, \-1 is returned and 195.Va errno 196is not modified. 197Otherwise, the current variable value is returned. 198.Sh ERRORS 199The 200.Fn sysconf 201function may fail and set 202.Va errno 203for any of the errors specified for the library functions 204.Xr sysctl 3 . 205In addition, the following error may be reported: 206.Bl -tag -width Er 207.It Bq Er EINVAL 208The value of the 209.Fa name 210argument is invalid. 211.El 212.Sh SEE ALSO 213.Xr sysctl 3 214.Sh BUGS 215The value for _SC_STREAM_MAX is a minimum maximum, and required to be 216the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously 217small and misleading number. 218.Sh STANDARDS 219The 220.Fn sysconf 221function conforms to 222.St -p1003.1-90 . 223.Sh HISTORY 224The 225.Nm sysconf 226function first appeared in 227.Bx 4.4 . 228