1.\" $OpenBSD: sysconf.3,v 1.12 2000/04/05 17:40:28 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. 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.Dd April 19, 1994 35.Dt SYSCONF 3 36.Os 37.Sh NAME 38.Nm sysconf 39.Nd get configurable system variables 40.Sh SYNOPSIS 41.Fd #include <unistd.h> 42.Ft long 43.Fn sysconf "int name" 44.Sh DESCRIPTION 45This interface is defined by 46.St -p1003.1-88 . 47A far more complete interface is available using 48.Xr sysctl 3 . 49.Pp 50The 51.Fn sysconf 52function provides a method for applications to determine the current 53value of a configurable system limit or option variable. 54The 55.Fa name 56argument specifies the system variable to be queried. 57Symbolic constants for each name value are found in the include file 58.Li <unistd.h> . 59.Pp 60The available values are as follows: 61.Pp 62.Bl -tag -width "123456" 63.Pp 64.It Li _SC_ARG_MAX 65The maximum bytes of arguments to 66.Xr exec 2 67(including the environment). 68.It Li _SC_CHILD_MAX 69The maximum number of simultaneous processes per user id. 70.It Li _SC_CLK_TCK 71The number of clock ticks per second. 72.It Li _SC_NGROUPS_MAX 73The maximum number of supplemental groups. 74.It Li _SC_OPEN_MAX 75The maximum number of open files per user id. 76.It Li _SC_STREAM_MAX 77The minimum maximum number of streams that a process may have open 78at any one time. 79.It Li _SC_TZNAME_MAX 80The minimum maximum number of types supported for the name of a 81timezone. 82.It Li _SC_JOB_CONTROL 83Returns 1 if job control is available on this system, otherwise \-1. 84.It Li _SC_SAVED_IDS 85Returns 1 if saved set-group-ID and saved set-user-ID is available, 86otherwise \-1. 87.It Li _SC_VERSION 88The version of ISO/IEC 9945 (POSIX 1003.1) with which the system 89attempts to comply. 90.It Li _SC_BC_BASE_MAX 91The maximum ibase/obase values in the 92.Xr bc 1 93utility. 94.It Li _SC_BC_DIM_MAX 95The maximum array size in the 96.Xr bc 1 97utility. 98.It Li _SC_BC_SCALE_MAX 99The maximum scale value in the 100.Xr bc 1 101utility. 102.It Li _SC_BC_STRING_MAX 103The maximum string length in the 104.Xr bc 1 105utility. 106.It Li _SC_COLL_WEIGHTS_MAX 107The maximum number of weights that can be assigned to any entry of 108the LC_COLLATE order keyword in the locale definition file. 109.It Li _SC_EXPR_NEST_MAX 110The maximum number of expressions that can be nested within 111parenthesis by the 112.Xr expr 1 113utility. 114.It Li _SC_LINE_MAX 115The maximum length in bytes of a text-processing utility's input 116line. 117.It Li _SC_RE_DUP_MAX 118The maximum number of repeated occurrences of a regular expression 119permitted when using interval notation. 120.It Li _SC_2_VERSION 121The version of POSIX 1003.2 with which the system attempts to comply. 122.It Li _SC_2_C_BIND 123Return 1 if the system's C-language development facilities support the 124C-Language Bindings Option, otherwise \-1. 125.It Li _SC_2_C_DEV 126Return 1 if the system supports the C-Language Development Utilities Option, 127otherwise \-1. 128.It Li _SC_2_CHAR_TERM 129Return 1 if the system supports at least one terminal type capable of 130all operations described in POSIX 1003.2, otherwise \-1. 131.It Li _SC_2_FORT_DEV 132Return 1 if the system supports the FORTRAN Development Utilities Option, 133otherwise \-1. 134.It Li _SC_2_FORT_RUN 135Return 1 if the system supports the FORTRAN Runtime Utilities Option, 136otherwise \-1. 137.It Li _SC_2_LOCALEDEF 138Return 1 if the system supports the creation of locales, otherwise \-1. 139.It Li _SC_2_SW_DEV 140Return 1 if the system supports the Software Development Utilities Option, 141otherwise \-1. 142.It Li _SC_2_UPE 143Return 1 if the system supports the User Portability Utilities Option, 144otherwise \-1. 145.It Li _SC_PAGESIZE 146The size of a system page in bytes. 147.It Li _SC_FSYNC 148Return 1 if the system supports the File Synchronisation Option, otherwise \-1. 149.El 150.Sh RETURN VALUES 151If the call to 152.Fn sysconf 153is not successful, \-1 is returned and 154.Va errno 155is set appropriately. 156Otherwise, if the variable is associated with functionality that is not 157supported, \-1 is returned and 158.Va errno 159is not modified. 160Otherwise, the current variable value is returned. 161.Sh ERRORS 162The 163.Fn sysconf 164function may fail and set 165.Va errno 166for any of the errors specified for the library functions 167.Xr sysctl 3 . 168In addition, the following error may be reported: 169.Bl -tag -width Er 170.It Bq Er EINVAL 171The value of the 172.Fa name 173argument is invalid. 174.El 175.Sh SEE ALSO 176.Xr sysctl 3 177.Sh BUGS 178The value for _SC_STREAM_MAX is a minimum maximum, and required to be 179the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously 180small and misleading number. 181.Sh STANDARDS 182The 183.Fn sysconf 184function conforms to 185.St -p1003.1-88 . 186.Sh HISTORY 187The 188.Fn sysconf 189function first appeared in 190.Bx 4.4 . 191