1.\" $OpenBSD: sysconf.3,v 1.16 2003/06/02 20:18:35 millert 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. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.Dd April 19, 1994 31.Dt SYSCONF 3 32.Os 33.Sh NAME 34.Nm sysconf 35.Nd get configurable system variables 36.Sh SYNOPSIS 37.Fd #include <unistd.h> 38.Ft long 39.Fn sysconf "int name" 40.Sh DESCRIPTION 41This interface is defined by 42.St -p1003.1-88 . 43A far more complete interface is available using 44.Xr sysctl 3 . 45.Pp 46The 47.Fn sysconf 48function provides a method for applications to determine the current 49value of a configurable system limit or option variable. 50The 51.Fa name 52argument specifies the system variable to be queried. 53Symbolic constants for each name value are found in the include file 54.Aq Pa unistd.h . 55.Pp 56The available values are as follows: 57.Pp 58.Bl -tag -width "123456" 59.Pp 60.It Li _SC_ARG_MAX 61The maximum bytes of arguments to 62.Xr exec 3 63(including the environment). 64.It Li _SC_CHILD_MAX 65The maximum number of simultaneous processes per user id. 66.It Li _SC_CLK_TCK 67The number of clock ticks per second. 68.It Li _SC_NGROUPS_MAX 69The maximum number of supplemental groups. 70.It Li _SC_OPEN_MAX 71The maximum number of open files per user id. 72.It Li _SC_STREAM_MAX 73The minimum maximum number of streams that a process may have open 74at any one time. 75.It Li _SC_TZNAME_MAX 76The minimum maximum number of types supported for the name of a 77timezone. 78.It Li _SC_JOB_CONTROL 79Returns 1 if job control is available on this system, otherwise \-1. 80.It Li _SC_SAVED_IDS 81Returns 1 if saved set-group-ID and saved set-user-ID is available, 82otherwise \-1. 83.It Li _SC_VERSION 84The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 85attempts to comply. 86.It Li _SC_BC_BASE_MAX 87The maximum ibase/obase values in the 88.Xr bc 1 89utility. 90.It Li _SC_BC_DIM_MAX 91The maximum array size in the 92.Xr bc 1 93utility. 94.It Li _SC_BC_SCALE_MAX 95The maximum scale value in the 96.Xr bc 1 97utility. 98.It Li _SC_BC_STRING_MAX 99The maximum string length in the 100.Xr bc 1 101utility. 102.It Li _SC_COLL_WEIGHTS_MAX 103The maximum number of weights that can be assigned to any entry of 104the LC_COLLATE order keyword in the locale definition file. 105.It Li _SC_EXPR_NEST_MAX 106The maximum number of expressions that can be nested within 107parenthesis by the 108.Xr expr 1 109utility. 110.It Li _SC_LINE_MAX 111The maximum length in bytes of a text-processing utility's input 112line. 113.It Li _SC_RE_DUP_MAX 114The maximum number of repeated occurrences of a regular expression 115permitted when using interval notation. 116.It Li _SC_2_VERSION 117The version of POSIX 1003.2 with which the system attempts to comply. 118.It Li _SC_2_C_BIND 119Return 1 if the system's C-language development facilities support the 120C-Language Bindings Option, otherwise \-1. 121.It Li _SC_2_C_DEV 122Return 1 if the system supports the C-Language Development Utilities Option, 123otherwise \-1. 124.It Li _SC_2_CHAR_TERM 125Return 1 if the system supports at least one terminal type capable of 126all operations described in POSIX 1003.2, otherwise \-1. 127.It Li _SC_2_FORT_DEV 128Return 1 if the system supports the FORTRAN Development Utilities Option, 129otherwise \-1. 130.It Li _SC_2_FORT_RUN 131Return 1 if the system supports the FORTRAN Runtime Utilities Option, 132otherwise \-1. 133.It Li _SC_2_LOCALEDEF 134Return 1 if the system supports the creation of locales, otherwise \-1. 135.It Li _SC_2_SW_DEV 136Return 1 if the system supports the Software Development Utilities Option, 137otherwise \-1. 138.It Li _SC_2_UPE 139Return 1 if the system supports the User Portability Utilities Option, 140otherwise \-1. 141.It Li _SC_PAGESIZE 142The size of a system page in bytes. 143.It Li _SC_FSYNC 144Return 1 if the system supports the File Synchronisation Option, otherwise \-1. 145.El 146.Sh RETURN VALUES 147If the call to 148.Fn sysconf 149is not successful, \-1 is returned and 150.Va errno 151is set appropriately. 152Otherwise, if the variable is associated with functionality that is not 153supported, \-1 is returned and 154.Va errno 155is not modified. 156Otherwise, the current variable value is returned. 157.Sh ERRORS 158The 159.Fn sysconf 160function may fail and set 161.Va errno 162for any of the errors specified for the library functions 163.Xr sysctl 3 . 164In addition, the following error may be reported: 165.Bl -tag -width Er 166.It Bq Er EINVAL 167The value of the 168.Fa name 169argument is invalid. 170.El 171.Sh SEE ALSO 172.Xr sysctl 3 173.Sh STANDARDS 174The 175.Fn sysconf 176function conforms to 177.St -p1003.1-88 . 178.Sh HISTORY 179The 180.Fn sysconf 181function first appeared in 182.Bx 4.4 . 183.Sh BUGS 184The value for _SC_STREAM_MAX is a minimum maximum, and required to be 185the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously 186small and misleading number. 187