xref: /freebsd/lib/libc/gen/sysconf.3 (revision 05c7a37afb48ddd5ee1bd921a5d46fe59cc70b15)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	@(#)sysconf.3	8.3 (Berkeley) 4/19/94
33.\"
34.Dd April 19, 1994
35.Dt SYSCONF 3
36.Os BSD 4
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
45.Pp
46This interface is defined by
47.St -p1003.1-88 .
48A far more complete interface is available using
49.Xr sysctl 3 .
50.Pp
51The
52.Fn sysconf
53function provides a method for applications to determine the current
54value of a configurable system limit or option variable.
55The
56.Fa name
57argument specifies the system variable to be queried.
58Symbolic constants for each name value are found in the include file
59.Li <unistd.h> .
60.Pp
61The available values are as follows:
62.Pp
63.Bl -tag -width "123456"
64.Pp
65.It Li _SC_ARG_MAX
66The maximum bytes of argument to
67.Xr execve 2 .
68.It Li _SC_CHILD_MAX
69The maximum number of simultaneous processes per user id.
70.It Li _SC_CLK_TCK
71Number of micro-seconds per hz tick.
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
83Return 1 if job control is available on this system, otherwise \-1.
84.It Li _SC_SAVED_IDS
85Returns 1 if saved set-group 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.El
146.Sh RETURN VALUES
147If the call to
148.Nm 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.Sh SEE ALSO
171.Xr sysctl 3
172.Sh BUGS
173The value for _SC_STREAM_MAX is a minimum maximum, and required to be
174the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
175small and misleading number.
176.Sh STANDARDS
177The
178.Fn sysconf
179function conforms to
180.St -p1003.1-88 .
181.Sh HISTORY
182The
183.Nm sysconf
184function first appeared in 4.4BSD.
185