1 .\" $NetBSD: sysconf.3,v 1.35 2009/03/15 09:31:07 joerg 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 maxmimum 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 NULL.
93 structures that a process has available for use with
101 .It Li _SC_JOB_CONTROL
102 Return 1 if job control is available on this system, otherwise \-1.
103 .It Li _SC_LOGIN_NAME_MAX
104 Returns the size of the storage required for a login name, in bytes,
105 including the terminating NUL.
106 .It Li _SC_MAPPED_FILES
107 Return 1 if the Memory Mapped Files Option is available on this system,
110 Return 1 if the Process Memory Locking Option is available on this system,
112 .It Li _SC_MEMLOCK_RANGE
113 Return 1 if the Range Memory Locking Option is available on this system,
115 .It Li _SC_MEMORY_PROTECTION
116 Return 1 if the Memory Protection Option is available on this system,
118 .It Li _SC_MONOTONIC_CLOCK
121 version the implementation of the Monotonic Clock Option
122 on this system conforms to,
123 or \-1 if unavailable.
124 .It Li _SC_NGROUPS_MAX
125 The maximum number of supplemental groups.
127 The maximum number of open files per process.
129 The size of a system page in bytes.
131 The maximum length of the password, not counting NULL.
132 .It Li _SC_READER_WRITER_LOCKS
137 option to which the system attempts to conform,
142 regular expressions are available on this system, otherwise \-1.
143 .It Li _SC_SEMAPHORES
148 option to which the system attempts to conform,
153 option depends on the
154 .Li P1003_1B_SEMAPHORE
159 shell is available on this system, otherwise \-1.
160 .It Li _SC_SPIN_LOCKS
165 option to which the system attempts to conform,
167 .It Li _SC_STREAM_MAX
168 The minimum maximum number of streams that a process may have open
170 .It Li _SC_SYMLOOP_MAX
171 The maximum number of symbolic links that may be expanded in a path name.
172 .It Li _SC_SYNCHRONIZED_IO
173 Return 1 if the Synchronized I/O Option is available on this system,
180 option to which the system attempts to conform,
187 option to which the system attempts to conform,
189 .It Li _SC_TZNAME_MAX
190 The minimum maximum number of types supported for the name of a
193 Returns 1 if saved set-group and saved set-user ID is available,
196 The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
202 option is available on this system,
207 option depends on the
210 .It Li _SC_BC_BASE_MAX
211 The maximum ibase/obase values in the
214 .It Li _SC_BC_DIM_MAX
215 The maximum array size in the
218 .It Li _SC_BC_SCALE_MAX
219 The maximum scale value in the
222 .It Li _SC_BC_STRING_MAX
223 The maximum string length in the
226 .It Li _SC_COLL_WEIGHTS_MAX
227 The maximum number of weights that can be assigned to any entry of
228 the LC_COLLATE order keyword in the locale definition file.
229 .It Li _SC_EXPR_NEST_MAX
230 The maximum number of expressions that can be nested within
235 The maximum length in bytes of a text-processing utility's input
237 .It Li _SC_RE_DUP_MAX
238 The maximum number of repeated occurrences of a regular expression
239 permitted when using interval notation.
241 The version of POSIX 1003.2 with which the system attempts to comply.
243 Return 1 if the system's C-language development facilities support the
244 C-Language Bindings Option, otherwise \-1.
246 Return 1 if the system supports the C-Language Development Utilities Option,
248 .It Li _SC_2_CHAR_TERM
249 Return 1 if the system supports at least one terminal type capable of
250 all operations described in POSIX 1003.2, otherwise \-1.
251 .It Li _SC_2_FORT_DEV
252 Return 1 if the system supports the FORTRAN Development Utilities Option,
254 .It Li _SC_2_FORT_RUN
255 Return 1 if the system supports the FORTRAN Runtime Utilities Option,
257 .It Li _SC_2_LOCALEDEF
258 Return 1 if the system supports the creation of locales, otherwise \-1.
260 Return 1 if the system supports the Software Development Utilities Option,
263 Return 1 if the system supports the User Portability Utilities Option,
265 .It Li _SC_GETGR_R_SIZE_MAX
266 The minimum size of the
272 .It Li _SC_GETPW_R_SIZE_MAX
273 The minimum size of the
279 .It Li _SC_NPROCESSORS_CONF
280 The number of processors configured.
281 .It Li _SC_NPROCESSORS_ONLN
282 The number of processors online (capable of running processes).
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:
317 .Li _SC_NPROCESSORS_CONF
319 .Li _SC_NPROCESSORS_ONLN
320 are not part of the standard, but are provided by many systems.
324 function first appeared in
327 The value for _SC_STREAM_MAX is a minimum maximum, and required to be
328 the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
329 small and misleading number.