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