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