xref: /original-bsd/lib/libc/gen/sysconf.3 (revision b0ffd8b4)
1.\" Copyright (c) 1993 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"	@(#)sysconf.3	5.1 (Berkeley) 05/24/93
7.\"
8.Dd
9.Dt SYSCONF 3
10.Os BSD 4
11.Sh NAME
12.Nm sysconf
13.Nd get configurable system variables
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft long
17.Fn sysconf "int name"
18.Sh DESCRIPTION
19.Bf -symbolic
20This interface is obsoleted by sysctl(3).
21.Ef
22.Pp
23The
24.Fn sysconf
25function provides a method for applications to determine the current
26value of a configurable system limit or option variable.
27The
28.Fa name
29argument specifies the system variable to be queried.
30Symbolic constants for each name value are found in the include file
31.Li <unistd.h> .
32.Pp
33The available values are as follows:
34.Pp
35.Bl -tag -width "123456"
36.Pp
37.It Li _SC_ARG_MAX
38The maximum bytes of argument to
39.Xr exec 2 .
40.It Li _SC_CHILD_MAX
41The maximum number of simultaneous processes per user id.
42.It Li _SC_CLK_TCK
43Number of micro-seconds per hz tick.
44.It Li _SC_NGROUPS_MAX
45The maximum number of supplemental groups.
46.It Li _SC_OPEN_MAX
47The maximum number of open files per user id.
48.It Li _SC_STREAM_MAX
49The minimum maximum number of streams that a process may have open
50at any one time.
51.It Li _SC_TZNAME_MAX
52The minimum maximum number of types supported for the name of a
53timezone.
54.It Li _SC_JOB_CONTROL
55Return 1 if job control is available on this system, otherwise \-1.
56.It Li _SC_SAVED_IDS
57Returns 1 if saved set-group and saved set-user ID is available,
58otherwise \-1.
59.It Li _SC_VERSION
60The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
61attempts to comply.
62.It Li _SC_BC_BASE_MAX
63The maximum ibase/obase values in the
64.Xr bc 1
65utility.
66.It Li _SC_BC_DIM_MAX
67The maximum array size in the
68.Xr bc 1
69utility.
70.It Li _SC_BC_SCALE_MAX
71The maximum scale value in the
72.Xr bc 1
73utility.
74.It Li _SC_BC_STRING_MAX
75The maximum string length in the
76.Xr bc 1
77utility.
78.It Li _SC_COLL_WEIGHTS_MAX
79The maximum number of weights that can be assigned to any entry of
80the LC_COLLATE order keyword in the locale definition file.
81.It Li _SC_EXPR_NEST_MAX
82The maximum number of expressions that can be nested within
83parenthesis by the
84.Xr expr 1
85utility.
86.It Li _SC_LINE_MAX
87The maximum length in bytes of a text-processing utility's input
88line.
89.It Li _SC_RE_DUP_MAX
90The maximum number of repeated occurrences of a regular expression
91permitted when using interval notation.
92.It Li _SC_2_VERSION
93The version of POSIX 1003.2 with which the system attempts to comply.
94.It Li _SC_2_C_BIND
95Return 1 if the system's C-language development facilities support the
96C-Language Bindings Option, otherwise \-1.
97.It Li _SC_2_C_DEV
98Return 1 if the system supports the C-Language Development Utilities Option,
99otherwise \-1.
100.It Li _SC_2_CHAR_TERM
101Return 1 if the system supports at least one terminal type capable of
102all operations described in POSIX 1003.2, otherwise \-1.
103.It Li _SC_2_FORT_DEV
104Return 1 if the system supports the FORTRAN Development Utilities Option,
105otherwise \-1.
106.It Li _SC_2_FORT_RUN
107Return 1 if the system supports the FORTRAN Runtime Utilities Option,
108otherwise \-1.
109.It Li _SC_2_LOCALEDEF
110Return 1 if the system supports the creation of locales, otherwise \-1.
111.It Li _SC_2_SW_DEV
112Return 1 if the system supports the Software Development Utilities Option,
113otherwise \-1.
114.It Li _SC_2_UPE
115Return 1 if the system supports the User Portability Utilities Option,
116otherwise \-1.
117.El
118.Sh RETURN VALUES
119If the call to
120.Nm sysconf
121is not successful, \-1 is returned and
122.Va errno
123is set appropriately.
124Otherwise, if the variable is associated with funtionality that is not
125supported, \-1 is returned and
126.Va errno
127is not modified.
128Otherwise, the current variable value is returned.
129.Sh ERRORS
130The
131.Fn sysconf
132function may fail and set
133.Va errno
134for any of the errors specified for the library functions
135.Xr sysctl 3 .
136In addition, the following errors may be reported:
137.Bl -tag -width Er
138.It Bq Er EINVAL
139The value of the
140.Fa name
141argument is invalid.
142.Sh SEE ALSO
143.Xr sysctl 3
144.Sh HISTORY
145The
146.Nm sysconf
147function first appeared in 4.4BSD.
148.Sh BUGS
149The value for _SC_STREAM_MAX is a minimum maximum, and required to be
150the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
151small and misleading number.
152