1 .\" $NetBSD: sysconf.3,v 1.44 2015/08/20 11:05:39 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 shell is available on this system, otherwise \-1.
156 .It Li _SC_SPIN_LOCKS
161 option to which the system attempts to conform,
163 .It Li _SC_STREAM_MAX
164 The minimum maximum number of streams that a process may have open
166 .It Li _SC_SYMLOOP_MAX
167 The maximum number of symbolic links that may be expanded in a path name.
168 .It Li _SC_SYNCHRONIZED_IO
169 Return 1 if the Synchronized I/O Option is available on this system,
176 option to which the system attempts to conform,
183 option to which the system attempts to conform,
185 .It Li _SC_TZNAME_MAX
186 The minimum maximum number of types supported for the name of a
189 Returns 1 if saved set-group and saved set-user ID is available,
192 The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
198 option is available on this system,
203 option depends on the
206 .It Li _SC_BC_BASE_MAX
207 The maximum ibase/obase values in the
210 .It Li _SC_BC_DIM_MAX
211 The maximum array size in the
214 .It Li _SC_BC_SCALE_MAX
215 The maximum scale value in the
218 .It Li _SC_BC_STRING_MAX
219 The maximum string length in the
222 .It Li _SC_COLL_WEIGHTS_MAX
223 The maximum number of weights that can be assigned to any entry of
224 the LC_COLLATE order keyword in the locale definition file.
225 .It Li _SC_EXPR_NEST_MAX
226 The maximum number of expressions that can be nested within
231 The maximum length in bytes of a text-processing utility's input
233 .It Li _SC_RE_DUP_MAX
234 The maximum number of repeated occurrences of a regular expression
235 permitted when using interval notation.
237 The version of POSIX 1003.2 with which the system attempts to comply.
239 Return 1 if the system's C-language development facilities support the
240 C-Language Bindings Option, otherwise \-1.
242 Return 1 if the system supports the C-Language Development Utilities Option,
244 .It Li _SC_2_CHAR_TERM
245 Return 1 if the system supports at least one terminal type capable of
246 all operations described in POSIX 1003.2, otherwise \-1.
247 .It Li _SC_2_FORT_DEV
248 Return 1 if the system supports the FORTRAN Development Utilities Option,
250 .It Li _SC_2_FORT_RUN
251 Return 1 if the system supports the FORTRAN Runtime Utilities Option,
253 .It Li _SC_2_LOCALEDEF
254 Return 1 if the system supports the creation of locales, otherwise \-1.
256 Return 1 if the system supports the Software Development Utilities Option,
259 Return 1 if the system supports the User Portability Utilities Option,
261 .It Li _SC_GETGR_R_SIZE_MAX
262 The minimum size of the
268 .It Li _SC_GETPW_R_SIZE_MAX
269 The minimum size of the
275 .It Li _SC_NPROCESSORS_CONF
276 The number of processors configured.
277 .It Li _SC_NPROCESSORS_ONLN
278 The number of processors online (capable of running processes).
279 .It Li _SC_PHYS_PAGES
280 The amount of physical memory on the system in
287 is not successful, \-1 is returned and
289 is set appropriately.
290 Otherwise, if the variable is associated with functionality that is not
291 supported, \-1 is returned and
294 Otherwise, the current variable value is returned.
298 function may fail and set
300 for any of the errors specified for the library functions
302 In addition, the following error may be reported:
319 .Li _SC_NPROCESSORS_CONF
321 .Li _SC_NPROCESSORS_ONLN
322 are not part of the standard, but are provided by many systems.
326 function first appeared in
329 The value for _SC_STREAM_MAX is a minimum maximum, and required to be
330 the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
331 small and misleading number.