1 .\" $NetBSD: sysconf.3,v 1.42 2012/11/03 00:52:41 wiz Exp $
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)sysconf.3 8.3 (Berkeley) 4/19/94
37 .Nd get configurable system variables
43 .Fn sysconf "int name"
45 This interface is defined by
47 A far more complete interface is available using
52 function provides a method for applications to determine the current
53 value of a configurable system limit or option variable.
56 argument specifies the system variable to be queried.
57 Symbolic constants for each name value are found in the include file
60 The available values are as follows:
61 .Bl -tag -width "123456"
63 The maximum bytes of argument to
66 The maximum number of functions that may be registered with
73 option to which the system attempts to conform,
75 .It Li _SC_CLOCK_SELECTION
78 version the implementation of the Clock Selection Option
79 on this system conforms to,
80 or \-1 if unavailable.
82 The maximum number of simultaneous processes per user id.
84 The number of clock ticks per second.
86 Return 1 if the File Synchronization Option is available on this system,
88 .It Li _SC_HOST_NAME_MAX
89 The maximum size of a hostname, including
94 structures that a process has available for use with
102 .It Li _SC_JOB_CONTROL
103 Return 1 if job control is available on this system, otherwise \-1.
104 .It Li _SC_LOGIN_NAME_MAX
105 Returns the size of the storage required for a login name, in bytes,
106 including the terminating NUL.
107 .It Li _SC_MAPPED_FILES
108 Return 1 if the Memory Mapped Files Option is available on this system,
111 Return 1 if the Process Memory Locking Option is available on this system,
113 .It Li _SC_MEMLOCK_RANGE
114 Return 1 if the Range Memory Locking Option is available on this system,
116 .It Li _SC_MEMORY_PROTECTION
117 Return 1 if the Memory Protection Option is available on this system,
119 .It Li _SC_MONOTONIC_CLOCK
122 version the implementation of the Monotonic Clock Option
123 on this system conforms to,
124 or \-1 if unavailable.
125 .It Li _SC_NGROUPS_MAX
126 The maximum number of supplemental groups.
128 The maximum number of open files per process.
130 The size of a system page in bytes.
132 The maximum length of the password, not counting
134 .It Li _SC_READER_WRITER_LOCKS
139 option to which the system attempts to conform,
144 regular expressions are available on this system, otherwise \-1.
145 .It Li _SC_SEMAPHORES
150 option to which the system attempts to conform,
155 option depends on the
156 .Li P1003_1B_SEMAPHORE
161 shell is available on this system, otherwise \-1.
162 .It Li _SC_SPIN_LOCKS
167 option to which the system attempts to conform,
169 .It Li _SC_STREAM_MAX
170 The minimum maximum number of streams that a process may have open
172 .It Li _SC_SYMLOOP_MAX
173 The maximum number of symbolic links that may be expanded in a path name.
174 .It Li _SC_SYNCHRONIZED_IO
175 Return 1 if the Synchronized I/O Option is available on this system,
182 option to which the system attempts to conform,
189 option to which the system attempts to conform,
191 .It Li _SC_TZNAME_MAX
192 The minimum maximum number of types supported for the name of a
195 Returns 1 if saved set-group and saved set-user ID is available,
198 The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
204 option is available on this system,
209 option depends on the
212 .It Li _SC_BC_BASE_MAX
213 The maximum ibase/obase values in the
216 .It Li _SC_BC_DIM_MAX
217 The maximum array size in the
220 .It Li _SC_BC_SCALE_MAX
221 The maximum scale value in the
224 .It Li _SC_BC_STRING_MAX
225 The maximum string length in the
228 .It Li _SC_COLL_WEIGHTS_MAX
229 The maximum number of weights that can be assigned to any entry of
230 the LC_COLLATE order keyword in the locale definition file.
231 .It Li _SC_EXPR_NEST_MAX
232 The maximum number of expressions that can be nested within
237 The maximum length in bytes of a text-processing utility's input
239 .It Li _SC_RE_DUP_MAX
240 The maximum number of repeated occurrences of a regular expression
241 permitted when using interval notation.
243 The version of POSIX 1003.2 with which the system attempts to comply.
245 Return 1 if the system's C-language development facilities support the
246 C-Language Bindings Option, otherwise \-1.
248 Return 1 if the system supports the C-Language Development Utilities Option,
250 .It Li _SC_2_CHAR_TERM
251 Return 1 if the system supports at least one terminal type capable of
252 all operations described in POSIX 1003.2, otherwise \-1.
253 .It Li _SC_2_FORT_DEV
254 Return 1 if the system supports the FORTRAN Development Utilities Option,
256 .It Li _SC_2_FORT_RUN
257 Return 1 if the system supports the FORTRAN Runtime Utilities Option,
259 .It Li _SC_2_LOCALEDEF
260 Return 1 if the system supports the creation of locales, otherwise \-1.
262 Return 1 if the system supports the Software Development Utilities Option,
265 Return 1 if the system supports the User Portability Utilities Option,
267 .It Li _SC_GETGR_R_SIZE_MAX
268 The minimum size of the
274 .It Li _SC_GETPW_R_SIZE_MAX
275 The minimum size of the
281 .It Li _SC_NPROCESSORS_CONF
282 The number of processors configured.
283 .It Li _SC_NPROCESSORS_ONLN
284 The number of processors online (capable of running processes).
285 .It Li _SC_PHYS_PAGES
286 The amount of physical memory on the system in
293 is not successful, \-1 is returned and
295 is set appropriately.
296 Otherwise, if the variable is associated with functionality that is not
297 supported, \-1 is returned and
300 Otherwise, the current variable value is returned.
304 function may fail and set
306 for any of the errors specified for the library functions
308 In addition, the following error may be reported:
325 .Li _SC_NPROCESSORS_CONF
327 .Li _SC_NPROCESSORS_ONLN
328 are not part of the standard, but are provided by many systems.
332 function first appeared in
335 The value for _SC_STREAM_MAX is a minimum maximum, and required to be
336 the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
337 small and misleading number.