1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)sysconf.3 8.3 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
.Dd February 13, 2011
.Dt SYSCONF 3
.Os
.Sh NAME
.Nm sysconf
.Nd get configurable system variables
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In unistd.h
.Ft long
.Fn sysconf "int name"
.Sh DESCRIPTION
This interface is defined by
.St -p1003.1-88 .
A far more complete interface is available using
.Xr sysctl 3 .
.Pp
The
.Fn sysconf
function provides a method for applications to determine the current
value of a configurable system limit or option variable.
The
.Fa name
argument specifies the system variable to be queried.
Symbolic constants for each name value are found in the include file
.In unistd.h .
Shell programmers who need access to these parameters should use the
.Xr getconf 1
utility.
.Pp
The available values are as follows:
.Bl -tag -width 6n
.It Li _SC_ARG_MAX
The maximum bytes of argument to
.Xr execve 2 .
.It Li _SC_CHILD_MAX
The maximum number of simultaneous processes per user id.
.It Li _SC_CLK_TCK
The frequency of the statistics clock in ticks per second.
.It Li _SC_IOV_MAX
The maximum number of elements in the I/O vector used by
.Xr readv 2 ,
.Xr writev 2 ,
.Xr recvmsg 2 ,
and
.Xr sendmsg 2 .
.It Li _SC_NGROUPS_MAX
The maximum number of supplemental groups.
.It Li _SC_NPROCESSORS_CONF
The number of processors configured.
.It Li _SC_NPROCESSORS_ONLN
The number of processors currently online.
.It Li _SC_OPEN_MAX
The maximum number of open files per user id.
.It Li _SC_PAGESIZE
The size of a system page in bytes.
.It Li _SC_PAGE_SIZE
Equivalent to
.Li _SC_PAGESIZE .
.It Li _SC_STREAM_MAX
The minimum maximum number of streams that a process may have open
at any one time.
.It Li _SC_TZNAME_MAX
The minimum maximum number of types supported for the name of a
timezone.
.It Li _SC_JOB_CONTROL
Return 1 if job control is available on this system, otherwise \-1.
.It Li _SC_SAVED_IDS
Returns 1 if saved set-group and saved set-user ID is available,
otherwise \-1.
.It Li _SC_VERSION
The version of
.St -p1003.1
with which the system
attempts to comply.
.It Li _SC_BC_BASE_MAX
The maximum ibase/obase values in the
.Xr bc 1
utility.
.It Li _SC_BC_DIM_MAX
The maximum array size in the
.Xr bc 1
utility.
.It Li _SC_BC_SCALE_MAX
The maximum scale value in the
.Xr bc 1
utility.
.It Li _SC_BC_STRING_MAX
The maximum string length in the
.Xr bc 1
utility.
.It Li _SC_COLL_WEIGHTS_MAX
The maximum number of weights that can be assigned to any entry of
the LC_COLLATE order keyword in the locale definition file.
.It Li _SC_EXPR_NEST_MAX
The maximum number of expressions that can be nested within
parenthesis by the
.Xr expr 1
utility.
.It Li _SC_LINE_MAX
The maximum length in bytes of a text-processing utility's input
line.
.It Li _SC_RE_DUP_MAX
The maximum number of repeated occurrences of a regular expression
permitted when using interval notation.
.It Li _SC_2_VERSION
The version of
.St -p1003.2
with which the system attempts to comply.
.It Li _SC_2_C_BIND
Return 1 if the system's C-language development facilities support the
C-Language Bindings Option, otherwise \-1.
.It Li _SC_2_C_DEV
Return 1 if the system supports the C-Language Development Utilities Option,
otherwise \-1.
.It Li _SC_2_CHAR_TERM
Return 1 if the system supports at least one terminal type capable of
all operations described in
.St -p1003.2 ,
otherwise \-1.
.It Li _SC_2_FORT_DEV
Return 1 if the system supports the FORTRAN Development Utilities Option,
otherwise \-1.
.It Li _SC_2_FORT_RUN
Return 1 if the system supports the FORTRAN Runtime Utilities Option,
otherwise \-1.
.It Li _SC_2_LOCALEDEF
Return 1 if the system supports the creation of locales, otherwise \-1.
.It Li _SC_2_SW_DEV
Return 1 if the system supports the Software Development Utilities Option,
otherwise \-1.
.It Li _SC_2_UPE
Return 1 if the system supports the User Portability Utilities Option,
otherwise \-1.
.It Li _SC_AIO_LISTIO_MAX
Maximum number of I/O operations in a single list I/O call supported.
.It Li _SC_AIO_MAX
Maximum number of outstanding asynchronous I/O operations supported.
.It Li _SC_AIO_PRIO_DELTA_MAX
The maximum amount by which a process can decrease its asynchronous I/O
priority level from its own scheduling priority.
.It Li _SC_DELAYTIMER_MAX
Maximum number of timer expiration overruns.
.It Li _SC_MQ_OPEN_MAX
The maximum number of open message queue descriptors a process may hold.
.It Li _SC_RTSIG_MAX
Maximum number of realtime signals reserved for application use.
.It Li _SC_SEM_NSEMS_MAX
Maximum number of semaphores that a process may have.
.It Li _SC_SEM_VALUE_MAX
The maximum value a semaphore may have.
.It Li _SC_SIGQUEUE_MAX
Maximum number of queued signals that a process may send and have pending at
the receiver(s) at any time.
.It Li _SC_TIMER_MAX
Maximum number of timers per process supported.
.It Li _SC_GETGR_R_SIZE_MAX
Suggested initial value for the size of the group entry buffer.
.It Li _SC_GETPW_R_SIZE_MAX
Suggested initial value for the size of the password entry buffer.
.It Li _SC_HOST_NAME_MAX
Maximum length of a host name (not including the terminating null) as
returned from the
.Fn gethostname
function.
.It Li _SC_LOGIN_NAME_MAX
Maximum length of a login name.
.It Li _SC_THREAD_STACK_MIN
Minimum size in bytes of thread stack storage.
.It Li _SC_THREAD_THREADS_MAX
Maximum number of threads that can be created per process.
.It Li _SC_TTY_NAME_MAX
Maximum length of terminal device name.
.It Li _SC_SYMLOOP_MAX
Maximum number of symbolic links that can be reliably traversed in the
resolution of a pathname in the absence of a loop.
.It Li _SC_ATEXIT_MAX
Maximum number of functions that may be registered with
.Fn atexit .
.It Li _SC_XOPEN_VERSION
An integer value greater than or equal to 4,
indicating the version of the X/Open Portability Guide to which this
system conforms.
.It Li _SC_XOPEN_XCU_VERSION
An integer value indicating the version of the XCU Specification to which
this system conforms.
.El
.Pp
These values also exist, but may not be standard:
.Bl -tag -width 6n
.It Li _SC_CPUSET_SIZE
Size of the kernel cpuset.
.It Li _SC_PHYS_PAGES
The number of pages of physical memory.
Note that it is possible that the product of this value and the value of
.Li _SC_PAGESIZE
will overflow a
.Vt long
in some configurations on a 32bit machine.
.El
.Sh RETURN VALUES
If the call to
.Fn sysconf
is not successful, \-1 is returned and
.Va errno
is set appropriately.
Otherwise, if the variable is associated with functionality that is not
supported, \-1 is returned and
.Va errno
is not modified.
Otherwise, the current variable value is returned.
.Sh ERRORS
The
.Fn sysconf
function may fail and set
.Va errno
for any of the errors specified for the library function
.Xr sysctl 3 .
In addition, the following error may be reported:
.Bl -tag -width Er
.It Bq Er EINVAL
The value of the
.Fa name
argument is invalid.
.El
.Sh SEE ALSO
.Xr getconf 1 ,
.Xr pathconf 2 ,
.Xr confstr 3 ,
.Xr sysctl 3
.Sh STANDARDS
Except for the fact that values returned by
.Fn sysconf
may change over the lifetime of the calling process,
this function conforms to
.St -p1003.1-88 .
.Sh HISTORY
The
.Fn sysconf
function first appeared in
.Bx 4.4 .
.Sh BUGS
The value for _SC_STREAM_MAX is a minimum maximum, and required to be
the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
small and misleading number.
|