nrelease - fix/improve livecd
[dragonfly.git] / lib / libc / gen / sysconf.3
1 .\" Copyright (c) 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)sysconf.3   8.3 (Berkeley) 4/19/94
29 .\" $FreeBSD: src/lib/libc/gen/sysconf.3,v 1.8.2.6 2001/12/14 18:33:51 ru Exp $
30 .\"
31 .Dd August 20, 2021
32 .Dt SYSCONF 3
33 .Os
34 .Sh NAME
35 .Nm sysconf
36 .Nd get configurable system variables
37 .Sh LIBRARY
38 .Lb libc
39 .Sh SYNOPSIS
40 .In unistd.h
41 .Ft long
42 .Fn sysconf "int name"
43 .Sh DESCRIPTION
44 This interface is defined by
45 .St -p1003.1-88 .
46 A far more complete interface is available using
47 .Xr sysctl 3 .
48 .Pp
49 The
50 .Fn sysconf
51 function provides a method for applications to determine the current
52 value of a configurable system limit or option variable.
53 The
54 .Fa name
55 argument specifies the system variable to be queried.
56 Symbolic constants for each name value are found in the include file
57 .In unistd.h .
58 .Pp
59 The available values are as follows:
60 .Bl -tag -width 6n
61 .It Dv _SC_ADVISORY_INFO
62 The version of
63 .St -p1003.1
64 and its
65 Advisory Information
66 option to which the system attempts to conform,
67 otherwise \-1.
68 .It Dv _SC_AIO_LISTIO_MAX
69 Maximum number of I/O operations in a single list I/O call supported.
70 .It Dv _SC_AIO_MAX
71 Maximum number of outstanding asynchronous I/O operations supported.
72 .It Dv _SC_AIO_PRIO_DELTA_MAX
73 The maximum amount by which a process can decrease its asynchronous I/O
74 priority level from its own scheduling priority.
75 .It Dv _SC_ASYNCHRONOUS_IO
76 The version of
77 .St -p1003.1
78 and its
79 Asynchronous Input and Output
80 option to which the system attempts to conform,
81 otherwise \-1.
82 .It Dv _SC_ARG_MAX
83 The maximum bytes of argument to
84 .Xr execve 2 .
85 .It Dv _SC_ATEXIT_MAX
86 Maximum number of functions that may be registered with
87 .Fn atexit .
88 .It Dv _SC_BARRIERS
89 The version of
90 .St -p1003.1
91 and its
92 Barriers
93 option to which the system attempts to conform,
94 otherwise \-1.
95 .It Dv _SC_BC_BASE_MAX
96 The maximum ibase/obase values in the
97 .Xr bc 1
98 utility.
99 .It Dv _SC_BC_DIM_MAX
100 The maximum array size in the
101 .Xr bc 1
102 utility.
103 .It Dv _SC_BC_SCALE_MAX
104 The maximum scale value in the
105 .Xr bc 1
106 utility.
107 .It Dv _SC_BC_STRING_MAX
108 The maximum string length in the
109 .Xr bc 1
110 utility.
111 .It Dv _SC_CHILD_MAX
112 The maximum number of simultaneous processes per user id.
113 .It Dv _SC_CLK_TCK
114 The frequency of the statistics clock in ticks per second.
115 .It Dv _SC_CLOCK_SELECTION
116 Return the POSIX version the implementation of the Clock Selection Option
117 on this system conforms to, or \-1 if unavailable.
118 .It Dv _SC_COLL_WEIGHTS_MAX
119 The maximum number of weights that can be assigned to any entry of
120 the LC_COLLATE order keyword in the locale definition file.
121 .It Dv _SC_CPUTIME
122 The
123 .Dv CLOCK_PROCESS_CPUTIME_ID
124 clock ID is supported, otherwise \-1.
125 .It Dv _SC_DELAYTIMER_MAX
126 Maximum number of timer expiration overruns.
127 .It Dv _SC_EXPR_NEST_MAX
128 The maximum number of expressions that can be nested within
129 parenthesis by the
130 .Xr expr 1
131 utility.
132 .It Dv _SC_FSYNC
133 Return 1 if the File Synchronization Option is available on this system,
134 otherwise \-1.
135 .It Dv _SC_GETGR_R_SIZE_MAX
136 Suggested initial value for the size of the group entry buffer.
137 .It Dv _SC_GETPW_R_SIZE_MAX
138 Suggested initial value for the size of the password entry buffer.
139 .It Dv _SC_HOST_NAME_MAX
140 Maximum length of a host name (not including the terminating null) as
141 returned from the
142 .Xr gethostname 3 ,
143 function.
144 .It Dv _SC_IOV_MAX
145 The maximum number of elements in the I/O vector used by
146 .Xr readv 2 ,
147 .Xr writev 2 ,
148 .Xr recvmsg 2 ,
149 and
150 .Xr sendmsg 2 .
151 .It Dv _SC_IPV6
152 The version of
153 .St -p1003.1
154 and its
155 IPv6
156 option to which the system attempts to conform,
157 otherwise \-1.
158 .It Dv _SC_JOB_CONTROL
159 Return 1 if job control is available on this system, otherwise \-1.
160 .It Dv _SC_LINE_MAX
161 The maximum length in bytes of a text-processing utility's input
162 line.
163 .It Dv _SC_LOGIN_NAME_MAX
164 Maximum length of a login name.
165 .It Dv _SC_MAPPED_FILES
166 Return 1 if the Memory Mapped Files Option is available on this system,
167 otherwise \-1.
168 .It Dv _SC_MEMLOCK
169 Return 1 if the Process Memory Locking Option is available on this system,
170 otherwise \-1.
171 .It Dv _SC_MEMLOCK_RANGE
172 Return 1 if the Range Memory Locking Option is available on this system,
173 otherwise \-1.
174 .It Dv _SC_MEMORY_PROTECTION
175 Return 1 if the Memory Protection Option is available on this system,
176 otherwise \-1.
177 .It Dv _SC_MESSAGE_PASSING
178 Whether Message Passing option is supported.
179 .It Dv _SC_MONOTONIC_CLOCK
180 Return the POSIX version of the implementation of the Monotonic Clock
181 option that this system conforms to, or \-1 if unavailable.
182 .It Dv _SC_MQ_OPEN_MAX
183 The maximum number of open message queue descriptors per process.
184 .It Dv _SC_MQ_PRIO_MAX
185 The maximum number of message priorities supported by the implementation.
186 .It Dv _SC_NGROUPS_MAX
187 The maximum number of supplemental groups.
188 .It Dv _SC_OPEN_MAX
189 The maximum number of open files per user id.
190 .It Dv _SC_PAGESIZE
191 The size of a system page in bytes.
192 .It Dv _SC_PAGE_SIZE
193 Equivalent to
194 .Dv _SC_PAGESIZE .
195 .It Dv _SC_PRIORITIZED_IO
196 The version of
197 .St -p1003.1
198 and its
199 Prioritized Input and Output
200 option to which the system attempts to conform,
201 otherwise \-1.
202 .It Dv _SC_PRIORITY_SCHEDULING
203 The version of
204 .St -p1003.1
205 and its
206 Process Scheduling
207 option to which the system attempts to conform,
208 otherwise \-1.
209 .It Dv _SC_RAW_SOCKETS
210 The version of
211 .St -p1003.1
212 and its
213 Raw Sockets
214 option to which the system attempts to conform,
215 otherwise \-1.
216 .It Dv _SC_READER_WRITER_LOCKS
217 The version of
218 .St -p1003.1
219 and its
220 Read-Write Locks
221 option to which the system attempts to conform,
222 otherwise \-1.
223 .It Dv _SC_REALTIME_SIGNALS
224 The version of
225 .St -p1003.1
226 and its
227 Realtime Signals Extension
228 option to which the system attempts to conform,
229 otherwise \-1.
230 .It Dv _SC_RE_DUP_MAX
231 The maximum number of repeated occurrences of a regular expression
232 permitted when using interval notation.
233 .It Dv _SC_REGEXP
234 Return 1 if the system supports regular expression handling.
235 .It Dv _SC_RTSIG_MAX
236 Maximum number of realtime signals reserved for application use.
237 .It Dv _SC_SAVED_IDS
238 Return 1 if saved set-group and saved set-user ID is available,
239 otherwise \-1.
240 .It Dv _SC_SEMAPHORES
241 The version of
242 .St -p1003.1
243 and its
244 Semaphores
245 option to which the system attempts to conform,
246 otherwise \-1.
247 .It Dv _SC_SEM_NSEMS_MAX
248 Maximum number of semaphores that a process may have.
249 .It Dv _SC_SEM_VALUE_MAX
250 The maximum value a semaphore may have.
251 .It Dv _SC_SHARED_MEMORY_OBJECTS
252 The version of
253 .St -p1003.1
254 and its
255 Shared Memory Objects
256 option to which the system attempts to conform,
257 otherwise \-1.
258 .It Dv _SC_SHELL
259 Return 1 if the system supports the
260 .Tn POSIX
261 shell.
262 .It Dv _SC_SIGQUEUE_MAX
263 Maximum number of queued signals that a process may send and have pending at
264 the receiver(s) at any time.
265 .It Dv _SC_SPAWN
266 The version of
267 .St -p1003.1
268 and its
269 Spawn
270 option to which the system attempts to conform,
271 otherwise \-1.
272 .It Dv _SC_SPIN_LOCKS
273 The version of
274 .St -p1003.1
275 and its
276 Spin Locks
277 option to which the system attempts to conform,
278 otherwise \-1.
279 .It Dv _SC_SPORADIC_SERVER
280 The version of
281 .St -p1003.1
282 and its
283 Process Sporadic Server
284 option to which the system attempts to conform,
285 otherwise \-1.
286 .It Dv _SC_STREAM_MAX
287 The maximum number of streams that a process may have open at any one time.
288 .It Dv _SC_SYMLOOP_MAX
289 Maximum number of symbolic links that can be reliably traversed in the
290 resolution of a pathname in the absence of a loop.
291 .It Dv _SC_SYNCHRONIZED_IO
292 Return 1 if the Synchronized I/O Option is available on this system,
293 otherwise \-1.
294 .It Dv _SC_THREAD_ATTR_STACKADDR
295 The version of
296 .St -p1003.1
297 and its
298 Thread Stack Address Attribute
299 option to which the system attempts to conform,
300 otherwise \-1.
301 .It Dv _SC_THREAD_ATTR_STACKSIZE
302 The version of
303 .St -p1003.1
304 and its
305 Thread Stack Size Attribute
306 option to which the system attempts to conform,
307 otherwise \-1.
308 .It Dv _SC_THREAD_CPUTIME
309 The
310 .Dv CLOCK_THREAD_CPUTIME_ID
311 clock ID is supported, otherwise \-1.
312 .It Dv _SC_THREAD_PRIO_INHERIT
313 The version of
314 .St -p1003.1
315 and its
316 Thread Priority Inheritance
317 option to which the system attempts to conform,
318 otherwise \-1.
319 .It Dv _SC_THREAD_PRIO_PROTECT
320 Whether the system supports the priority ceiling protocol for POSIX threads.
321 .It Dv _SC_THREAD_PRIORITY_SCHEDULING
322 The version of
323 .St -p1003.1
324 and its
325 Thread Execution Scheduling
326 option to which the system attempts to conform,
327 otherwise \-1.
328 .It Dv _SC_THREAD_PROCESS_SHARED
329 The version of
330 .St -p1003.1
331 and its
332 Thread Process-Shared Synchronization
333 option to which the system attempts to conform,
334 otherwise \-1.
335 .It Dv _SC_THREAD_ROBUST_PRIO_INHERIT
336 The version of
337 .St -p1003.1
338 and its
339 Robust Mutex Priority Inheritance
340 option to which the system attempts to conform,
341 otherwise \-1.
342 .It Dv _SC_THREAD_ROBUST_PRIO_PROTECT
343 The version of
344 .St -p1003.1
345 and its
346 Robust Mutex Priority Protection
347 option to which the system attempts to conform,
348 otherwise \-1.
349 .It Dv _SC_THREADS
350 The version of
351 .St -p1003.1
352 and its
353 Threads
354 option to which the system attempts to conform,
355 otherwise \-1.
356 .It Dv _SC_THREAD_SAFE_FUNCTIONS
357 The level of support for thread-safe (re-entrant) functions.
358 .It Dv _SC_THREAD_SPORADIC_SERVER
359 The version of
360 .St -p1003.1
361 and its
362 Thread Sporadic Server
363 option to which the system attempts to conform,
364 otherwise \-1.
365 .It Dv _SC_THREAD_STACK_MIN
366 Minimum size in bytes of thread stack storage.
367 .It Dv _SC_THREAD_THREADS_MAX
368 Maximum number of threads that can be created per process.
369 .It Dv _SC_TIMEOUTS
370 The version of
371 .St -p1003.1
372 and its
373 Timeouts
374 option to which the system attempts to conform,
375 otherwise \-1.
376 .It Dv _SC_TIMER_MAX
377 Maximum number of timers per process supported.
378 .It Dv _SC_TIMERS
379 The version of
380 .St -p1003.1
381 and its
382 Timers
383 option to which the system attempts to conform,
384 otherwise \-1.
385 .It Dv _SC_TTY_NAME_MAX
386 Maximum length of terminal device name.
387 .It Dv _SC_TYPED_MEMORY_OBJECTS
388 The version of
389 .St -p1003.1
390 and its
391 Typed Memory Objects
392 option to which the system attempts to conform,
393 otherwise \-1.
394 .It Dv _SC_TZNAME_MAX
395 The maximum number of bytes supported for the name of a timezone.
396 .It Dv _SC_VERSION
397 The version of
398 .St -p1003.1
399 with which the system
400 attempts to comply.
401 .It Dv _SC_XOPEN_SHM
402 Return 1 if the system supports the
403 .St -xpg4.2
404 Shared Memory Feature
405 for both compilation and execution, or 0 if only compilation support is
406 guaranteed.
407 .It Dv _SC_XOPEN_VERSION
408 An integer value greater than or equal to 4,
409 indicating the version of the X/Open Portability Guide to which this
410 system conforms.
411 .It Dv _SC_2_C_BIND
412 Return 1 if the system's C-language development facilities support the
413 C-Language Bindings Option, otherwise \-1.
414 .It Dv _SC_2_C_DEV
415 Return 1 if the system supports the C-Language Development Utilities Option,
416 otherwise \-1.
417 .It Dv _SC_2_CHAR_TERM
418 Return 1 if the system supports at least one terminal type capable of
419 all operations described in
420 .St -p1003.2 ,
421 otherwise \-1.
422 .It Dv _SC_2_FORT_DEV
423 Return 1 if the system supports the FORTRAN Development Utilities Option,
424 otherwise \-1.
425 .It Dv _SC_2_FORT_RUN
426 Return 1 if the system supports the FORTRAN Runtime Utilities Option,
427 otherwise \-1.
428 .It Dv _SC_2_LOCALEDEF
429 Return 1 if the system supports the creation of locales, otherwise \-1.
430 .It Dv _SC_2_SW_DEV
431 Return 1 if the system supports the Software Development Utilities Option,
432 otherwise \-1.
433 .It Dv _SC_2_UPE
434 Return 1 if the system supports the User Portability Utilities Option,
435 otherwise \-1.
436 .It Dv _SC_2_VERSION
437 The version of
438 .St -p1003.2
439 with which the system attempts to comply.
440 .El
441 .Pp
442 These values also exist, but may not be standard:
443 .Bl -tag -width 6n
444 .It Dv _SC_LEVEL1_DCACHE_LINESIZE
445 Returns the L1 cache line size.
446 .It Dv _SC_NPROCESSORS_CONF
447 The number of processors configured.
448 .It Dv _SC_NPROCESSORS_ONLN
449 The number of processors online.
450 .It Dv _SC_PHYS_PAGES
451 The number of pages of physical memory.
452 .El
453 .Sh RETURN VALUES
454 If the call to
455 .Fn sysconf
456 is not successful, \-1 is returned and
457 .Va errno
458 is set appropriately.
459 Otherwise, if the variable is associated with functionality that is not
460 supported, \-1 is returned and
461 .Va errno
462 is not modified.
463 Otherwise, the current variable value is returned.
464 .Pp
465 Because \-1 is a valid return value upon success, applications wishing
466 to check for real error conditions should set
467 .Va errno
468 to 0, then call
469 .Fn sysconf ,
470 and check
471 .Va errno
472 if \-1 is returned.
473 .Sh ERRORS
474 The
475 .Fn sysconf
476 function may fail and set
477 .Va errno
478 for any of the errors specified for the library function
479 .Xr sysctl 3 .
480 In addition, the following error may be reported:
481 .Bl -tag -width Er
482 .It Bq Er EINVAL
483 The value of the
484 .Fa name
485 argument is invalid.
486 .El
487 .Sh SEE ALSO
488 .Xr getconf 1 ,
489 .Xr pathconf 2 ,
490 .Xr confstr 3 ,
491 .Xr sysctl 3
492 .Sh STANDARDS
493 Except for the fact that values returned by
494 .Fn sysconf
495 may change over the lifetime of the calling process,
496 this function conforms to
497 .St -p1003.1-88 .
498 .Pp
499 .Dv _SC_NPROCESSORS_CONF
500 and
501 .Dv _SC_NPROCESSORS_ONLN
502 are nonstandard, but implemented in many systems.
503 .Sh HISTORY
504 The
505 .Fn sysconf
506 function first appeared in
507 .Bx 4.4 .