1 '\" te
2 .\" Copyright (c) 2013 Gary Mills
3 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
4 .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
5 .\" Copyright 1989 AT&T
6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
7 .\" http://www.opengroup.org/bookstore/.
8 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 .\" This notice shall appear on any product containing this material.
10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
11 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
12 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 .TH SYSCONF 3C "Apr 16, 2013"
14 .SH NAME
15 sysconf \- get configurable system variables
16 .SH SYNOPSIS
17 .LP
18 .nf
19 #include <unistd.h>
20
21 \fBlong\fR \fBsysconf\fR(\fBint\fR \fIname\fR);
22 .fi
23
24 .SH DESCRIPTION
25 .sp
26 .LP
27 The \fBsysconf()\fR function provides a method for an application to determine
28 the current value of a configurable system limit or option (variable).
29 .sp
30 .LP
31 The \fIname\fR argument represents the system variable to be queried. The
32 following table lists the minimal set of system variables from \fB<limits.h>\fR
33 and \fB<unistd.h>\fR that can be returned by \fBsysconf()\fR and the symbolic
34 constants defined in \fB<unistd.h>\fR that are the corresponding values used
35 for \fIname\fR on the SPARC and x86 platforms.
36 .sp
37 .in +2
38 .nf
39 Name Return Value Meaning
40 _______________________________________________________________________
41 _SC_2_C_BIND _POSIX2_C_BIND Supports the C lang-
42 uage binding option
43 _SC_2_C_DEV _POSIX2_C_DEV Supports the C lang-
44 uage development
45 utilities option
46 _SC_2_C_VERSION _POSIX2_C_VERSION Integer value
47 indicates version
48 of ISO POSIX-2
49 standard (Commands)
50 _SC_2_CHAR_TERM _POSIX2_CHAR_TERM Supports at least
51 one terminal
52 _SC_2_FORT_DEV _POSIX2_FORT_DEV Supports FORTRAN
53 Development
54 Utilities Option
55 _SC_2_FORT_RUN _POSIX2_FORT_RUN Supports FORTRAN
56 Run-time Utilities
57 Option
58 _SC_2_LOCALEDEF _POSIX2_LOCALEDEF Supports creation
59 of locales by the
60 localedef utility
61 _SC_2_SW_DEV _POSIX2_SW_DEV Supports Software
62 Development Utility
63 Option
64 _SC_2_UPE _POSIX2_UPE Supports User
65 Portability
66 Utilities Option
67 _SC_2_VERSION _POSIX2_VERSION Integer value
68 indicates version
69 of ISO POSIX-2
70 standard (C language
71 binding)
72 _SC_AIO_LISTIO_MAX AIO_LISTIO_MAX Max number of I/O
73 operations in a
74 single list I/O call
75 supported
76 _SC_AIO_MAX AIO_MAX Max number of
77 outstanding
78 asynchronous I/O
79 operations supported
80 _SC_AIO_PRIO_DELTA_MAX AIO_PRIO_DELTA_MAX Max amount by which
81 process can decrease
82 its asynchronous
83 I/O priority level
84 from its own
85 scheduling priority
86 _SC_ARG_MAX ARG_MAX Max size of argv[]
87 plus envp[]
88 _SC_ASYNCHRONOUS_IO _POSIX_ASYNCHRONOUS_IO Supports
89 Asynchronous I/O
90 _SC_ATEXIT_MAX ATEXIT_MAX Max number of
91 functions that can
92 be registered with
93 atexit()
94 _SC_AVPHYS_PAGES Number of physical
95 memory pages not
96 currently in use by
97 system
98 _SC_BARRIERS _POSIX_BARRIERS Supports Barriers
99 option
100 _SC_BC_BASE_MAX BC_BASE_MAX Maximum obase values
101 allowed by bc
102 _SC_BC_DIM_MAX BC_DIM_MAX Max number of
103 elements permitted
104 in array by bc
105 _SC_BC_SCALE_MAX BC_SCALE_MAX Max scale value
106 allowed by bc
107 _SC_BC_STRING_MAX BC_STRING_MAX Max length of string
108 constant allowed by
109 bc
110 _SC_CHILD_MAX CHILD_MAX Max processes
111 allowed to a UID
112 _SC_CLK_TCK CLK_TCK Ticks per second
113 (clock_t)
114 _SC_CLOCK_SELECTION _POSIX_CLOCK_SELECTION Supports Clock
115 Selection option
116 _SC_COLL_WEIGHTS_MAX COLL_WEIGHTS_MAX Max number of
117 weights that can be
118 assigned to entry of
119 the LC_COLLATE order
120 keyword in locale
121 definition file
122 _SC_CPUID_MAX Max possible
123 processor ID
124 _SC_DELAYTIMER_MAX DELAYTIMER_MAX Max number of timer
125 expiration overruns
126 _SC_EXPR_NEST_MAX EXPR_NEST_MAX Max number of
127 parentheses by expr
128 _SC_FSYNC _POSIX_FSYNC Supports File
129 Synchronization
130 _SC_GETGR_R_SIZE_MAX Max size of group
131 entry buffer
132 _SC_GETPW_R_SIZE_MAX Max size of password
133 entry buffer
134 _SC_HOST_NAME_MAX _POSIX_HOST_NAME_MAX Maximum length of a
135 host name (excluding
136 terminating null)
137 _SC_IOV_MAX IOV_MAX Max number of iovec
138 structures available
139 to one process for
140 use with readv()
141 and writev()
142 _SC_JOB_CONTROL _POSIX_JOB_CONTROL Job control
143 supported?
144 _SC_LINE_MAX LINE_MAX Max length of input
145 line
146 _SC_LOGIN_NAME_MAX LOGIN_NAME_MAX Max length of login
147 name
148 _SC_LOGNAME_MAX LOGNAME_MAX
149 _SC_MAPPED_FILES _POSIX_MAPPED_FILES Supports Memory
150 Mapped Files
151 _SC_MAXPID Max pid value
152 _SC_MEMLOCK _POSIX_MEMLOCK Supports Process
153 Memory Locking
154 _SC_MEMLOCK_RANGE _POSIX_MEMLOCK_RANGE Supports Range
155 Memory Locking
156 _SC_MEMORY_PROTECTION _POSIX_MEMORY_PROTECTION Supports Memory
157 Protection
158 _SC_MESSAGE_PASSING _POSIX_MESSAGE_PASSING Supports Message
159 Passing
160 _SC_MONOTONIC_CLOCK _POSIX_MONOTONIC_CLOCK Supports Monotonic
161 Clock option
162 _SC_MQ_OPEN_MAX MQ_OPEN_MAX Max number of open
163 message queues a
164 process can hold
165 _SC_MQ_PRIO_MAX MQ_PRIO_MAX Max number of
166 message priorities
167 supported
168 _SC_NGROUPS_MAX NGROUPS_MAX Max simultaneous
169 groups to which
170 one can belong
171 _SC_NPROCESSORS_CONF Number of processors
172 configured
173 _SC_NPROCESSORS_MAX Max number of
174 processors supported
175 by platform
176 _SC_NPROCESSORS_ONLN Number of processors
177 online
178 _SC_OPEN_MAX OPEN_MAX Max open files per
179 process
180 _SC_PAGESIZE PAGESIZE System memory page
181 size
182 _SC_PAGE_SIZE PAGESIZE Same as _SC_PAGESIZE
183 _SC_PASS_MAX PASS_MAX Max number of
184 significant bytes
185 in a password
186 _SC_PHYS_PAGES Total number of
187 pages of physical
188 memory in system
189 _SC_PRIORITIZED_IO _POSIX_PRIORITIZED_IO Supports Prioritized
190 I/O
191 _SC_PRIORITY_SCHEDULING _POSIX_PRIORITY_SCHEDULING Supports Process
192 Scheduling
193 _SC_RAW_SOCKETS _POSIX_RAW_SOCKETS Supports Raw Sockets
194 option
195 _SC_RE_DUP_MAX RE_DUP_MAX Max number of
196 repeated occurrences
197 of a regular
198 expression permitted
199 when using interval
200 notation \e{m,n\e}
201 _SC_READER_WRITER_LOCKS _POSIX_READER_WRITER_LOCKS Supports IPV6 option
202 _SC_REALTIME_SIGNALS _POSIX_REALTIME_SIGNALS Supports Realtime
203 Signals
204 _SC_REGEXP _POSIX_REGEXP Supports Regular
205 Expression Handling
206 option
207 _SC_RTSIG_MAX RTSIG_MAX Max number of
208 realtime signals
209 reserved for
210 application use
211 _SC_SAVED_IDS _POSIX_SAVED_IDS Saved IDs
212 (seteuid())
213 supported?
214 _SC_SEM_NSEMS_MAX SEM_NSEMS_MAX Max number of POSIX
215 semaphores a process
216 can have
217 _SC_SEM_VALUE_MAX SEM_VALUE_MAX Max value a POSIX
218 semaphore can have
219 _SC_SEMAPHORES _POSIX_SEMAPHORES Supports Semaphores
220 _SC_SHARED_MEMORY_ _POSIX_SHARED_MEMORY_ Supports Shared
221 OBJECTS OBJECTS Memory Objects
222 _SC_SHELL _POSIX_SHELL Supports POSIX shell
223 _SC_SIGQUEUE_MAX SIGQUEUE_MAX Max number of queued
224 signals that a
225 process can send and
226 have pending at
227 receiver(s) at a
228 time
229 _SC_SPAWN _POSIX_SPAWN Supports Spawn option
230 _SC_SPIN_LOCKS _POSIX_SPIN_LOCKS Supports Spin Locks
231 option
232 _SC_STACK_PROT Default stack
233 protection
234 _SC_STREAM_MAX STREAM_MAX Number of streams
235 one process can
236 have open at a time
237 _SC_SYMLOOP_MAX _POSIX_SYMLOOP_MAX Max number of symbolic
238 links that can be
239 reliably traversed in
240 the resolution of a
241 pathname in the absence
242 of a loop
243 _SC_SYNCHRONIZED_IO _POSIX_SYNCHRONIZED_IO Supports
244 Synchronized I/O
245 _SC_THREAD_ATTR_ _POSIX_THREAD_ATTR_ Supports Thread
246 STACKADDR STACKADDR Stack Address
247 Attribute option
248 _SC_THREAD_ATTR_ _POSIX_THREAD_ATTR_ Supports Thread
249 STACKSIZE STACKSIZE Stack Size
250 Attribute option
251 _SC_THREAD_DESTRUCTOR_ PTHREAD_DESTRUCTOR_ Number attempts made
252 ITERATIONS ITERATIONS to destroy thread-
253 specific data on
254 thread exit
255 _SC_THREAD_KEYS_MAX PTHREAD_KEYS_MAX Max number of data
256 keys per process
257 _SC_THREAD_PRIO_ _POSIX_THREAD_PRIO_ Supports Priority
258 INHERIT INHERIT Inheritance option
259 _SC_THREAD_PRIO_ _POSIX_THREAD_PRIO_ Supports Priority
260 PROTECT PROTECT Protection option
261 _SC_THREAD_PRIORITY_ _POSIX_THREAD_PRIORITY_ Supports Thread
262 SCHEDULING SCHEDULING Execution
263 Scheduling option
264 _SC_THREAD_PROCESS_ _POSIX_THREAD_PROCESS_ Supports
265 SHARED SHARED Process-Shared
266 Synchronization
267 option
268 _SC_THREAD_SAFE_ _POSIX_THREAD_SAFE_ Supports Thread-Safe
269 FUNCTIONS FUNCTIONS Functions option
270 _SC_THREAD_STACK_MIN PTHREAD_STACK_MIN Min byte size of
271 thread stack storage
272 _SC_THREAD_THREADS_MAX PTHREAD_THREADS_MAX Max number of
273 threads per process
274 _SC_THREADS _POSIX_THREADS Supports Threads
275 option
276 _SC_TIMEOUTS _POSIX_TIMEOUTS Supports Timeouts
277 option
278 _SC_TIMER_MAX TIMER_MAX Max number of timer
279 per process
280 supported
281 _SC_TIMERS _POSIX_TIMERS Supports Timers
282 _SC_TTY_NAME_MAX TTYNAME_MAX Max length of tty
283 device name
284 _SC_TZNAME_MAX TZNAME_MAX Max number of bytes
285 supported for name
286 of a time zone
287 _SC_V6_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 Supports X/Open
288 ILP32 w/32-bit
289 offset build
290 environment
291 _SC_V6_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG Supports X/Open
292 ILP32 w/64-bit
293 offset build
294 environment
295 _SC_V6_LP64_OFF64 _POSIX_V6_LP64_OFF64 Supports X/Open
296 LP64 w/64-bit
297 offset build
298 environment
299 _SC_V6_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG Same as
300 _SC_V6_LP64_OFF64
301 _SC_VERSION _POSIX_VERSION POSIX.1 version
302 supported
303 _SC_XBS5_ILP32_OFF32 _XBS_ILP32_OFF32 Indicates support
304 for X/Open ILP32
305 w/32-bit offset
306 build environment
307 _SC_XBS5_ILP32_OFFBIG _XBS5_ILP32_OFFBIG Indicates support
308 for X/Open ILP32
309 w/64-bit offset
310 build environment
311 _SC_XBS5_LP64_OFF64 _XBS5_LP64_OFF64 Indicates support of
312 X/Open LP64,
313 64-bit offset
314 build environment
315 _SC_XBS5_LPBIG_OFFBIG _XBS5_LP64_OFF64 Same as
316 _SC_XBS5_LP64_OFF64
317 _SC_XOPEN_CRYPT _XOPEN_CRYPT Supports X/Open
318 Encryption Feature
319 Group
320 _SC_XOPEN_ENH_I18N _XOPEN_ENH_I18N Supports X/Open
321 Enhanced
322 Internationalization
323 Feature Group
324 _SC_XOPEN_LEGACY _XOPEN_LEGACY Supports X/Open
325 Legacy Feature Group
326 _SC_XOPEN_REALTIME _XOPEN_REALTIME Supports X/Open
327 POSIX Realtime
328 Feature Group
329 _SC_XOPEN_REALTIME_ _XOPEN_REALTIME_THREADS Supports X/Open
330 THREADS POSIX Reatime
331 Threads Feature
332 Group
333 _SC_XOPEN_SHM _XOPEN_SHM Supports X/Open
334 Shared Memory
335 Feature Group
336 _SC_XOPEN_STREAMS _POSIX_XOPEN_STREAMS Supports XSI Streams
337 option group
338 _SC_XOPEN_UNIX _XOPEN_UNIX Supports X/Open CAE
339 Specification,
340 August 1994, System
341 Interfaces and
342 Headers, Issue 4,
343 Version 2
344 _SC_XOPEN_VERSION _XOPEN_VERSION Integer value
345 indicates version of
346 X/Open Portability
347 Guide to which
348 implementation
349 conforms
350 _SC_XOPEN_XCU_VERSION _XOPEN_XCU_VERSION Integer value
351 indicates version of
352 XCU specification to
353 which implementation
354 conforms
355 .fi
356 .in -2
357 .sp
358
359 .sp
360 .LP
361 The following options are not supported and return \(mi1:
362 .sp
363
364 .sp
365 .TS
366 l l
367 l l .
368 \fB_SC_2_PBS\fR \fB_POSIX2_PBS\fR
369 \fB_SC_2_PBS_ACCOUNTING\fR \fB_POSIX2_PBS_ACCOUNTING\fR
370 \fB_SC_2_PBS_CHECKPOINT\fR \fB_POSIX2_PBS_CHECKPOINT\fR
371 \fB_SC_2_PBS_LOCATE\fR \fB_POSIX2_PBS_LOCATE\fR
372 \fB_SC_2_PBS_MESSAGE\fR \fB_POSIX2_PBS_MESSAGE\fR
373 \fB_SC_2_PBS_TRACK\fR \fB_POSIX2_PBS_TRACK\fR
374 \fB_SC_ADVISORY_INFO\fR \fB_POSIX_ADVISORY_INFO\fR
375 \fB_SC_CPUTIME\fR \fB_POSIX_CPUTIME\fR
376 \fB_SC_SPORADIC_SERVER\fR \fB_POSIX_SPORADIC_SERVER\fR
377 \fB_SC_SS_REPL_MAX\fR \fB_POSIX_SS_REPL_MAX\fR
378 \fB_SC_THREAD_CPUTIME\fR \fB_POSIX_THREAD_CPUTIME\fR
379 \fB_SC_THREAD_SPORADIC_SERVER\fR \fB_POSIX_THREAD_SPORADIC_SERVER\fR
380 \fB_SC_TRACE\fR \fB_POSIX_TRACE\fR
381 \fB_SC_TRACE_EVENT_FILTER\fR \fB_POSIX_TRACE_EVENT_FILTER\fR
382 \fB_SC_TRACE_EVENT_NAME_MAX\fR \fB_POSIX_TRACE_EVENT_NAME_MAX\fR
383 \fB_SC_TRACE_INHERIT\fR \fB_POSIX_TRACE_INHERIT\fR
384 \fB_SC_TRACE_LOG\fR \fB_POSIX_TRACE_LOG\fR
385 \fB_SC_TRACE_NAME_MAX\fR \fB_POSIX_TRACE_NAME_MAX\fR
386 \fB_SC_TRACE_SYS_MAX\fR \fB_POSIX_TRACE_SYS_MAX\fR
387 \fB_SC_TRACE_USER_EVENT_MAX\fR \fB_POSIX_TRACE_USER_EVENT_MAX\fR
388 \fB_SC_TYPED_MEMORY_OBJECTS\fR \fB_POSIX_TYPED_MEMORY_OBJECTS\fR
389 .TE
390
391 .SH RETURN VALUES
392 .sp
393 .LP
394 Upon successful completion, \fBsysconf()\fR returns the current variable value
395 on the system. The value returned will not be more restrictive than the
396 corresponding value described to the application when it was compiled with the
397 implementation's <\fBlimits.h\fR>, <\fBunistd.h\fR> or <\fBtime.h\fR>. With
398 only a few obvious exceptions such as \fB_SC_AVPHYS_PAGES\fR and
399 \fB_SC_NPROCESSORS_ONLN\fR, the value will not change during the lifetime of
400 the calling process.
401 .sp
402 .LP
403 If \fIname\fR is an invalid value, \fBsysconf()\fR returns \fB\(mi1\fR and sets
404 \fBerrno\fR to indicate the error. If the variable corresponding to \fIname\fR
405 is associated with functionality that is not supported by the system,
406 \fBsysconf()\fR returns \fB\(mi1\fR without changing the value of \fIerrno\fR.
407 .sp
408 .LP
409 Calling \fBsysconf()\fR with the following returns \fB\(mi1\fR without setting
410 \fBerrno\fR, because no maximum limit can be determined. The system supports at
411 least the minimum values and can support higher values depending upon system
412 resources.
413 .sp
414 .in +2
415 .nf
416 Variable Minimum supported value
417 _SC_AIO_MAX _POSIX_AIO_MAX
418 _SC_ATEXIT_MAX 32
419 _SC_MQ_OPEN_MAX 32
420 _SC_THREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
421 _SC_THREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
422 _SC_THREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
423 .fi
424 .in -2
425
426 .sp
427 .LP
428 The following SPARC and x86 platform variables return \fBEINVAL\fR:
429 .sp
430 .in +2
431 .nf
432 _SC_COHER_BLKSZ _SC_DCACHE_ASSOC
433 _SC_DCACHE_BLKSZ _SC_DCACHE_LINESZ
434 _SC_DCACHE_SZ _SC_DCACHE_TBLKSZ
435 _SC_ICACHE_ASSOC _SC_ICACHE_BLKSZ
436 _SC_ICACHE_LINESZ _SC_ICACHE_SZ
437 _SC_SPLIT_CACHE
438 .fi
439 .in -2
440
441 .SH ERRORS
442 .sp
443 .LP
444 The \fBsysconf()\fR function will fail if:
445 .sp
446 .ne 2
447 .na
448 \fB\fBEINVAL\fR\fR
449 .ad
450 .RS 10n
451 The value of the \fIname\fR argument is invalid.
452 .RE
453
454 .SH ATTRIBUTES
455 .sp
456 .LP
457 See \fBattributes\fR(5) for descriptions of the following attributes:
458 .sp
459
460 .sp
461 .TS
462 box;
463 c | c
464 l | l .
465 ATTRIBUTE TYPE ATTRIBUTE VALUE
466 _
467 Architecture SPARC and x86
468 _
469 Interface Stability Committed
470 _
471 MT-Level MT-Safe, Async-Signal-Safe
472 _
473 Standard See \fBstandards\fR(5).
474 .TE
475
476 .SH SEE ALSO
477 .sp
478 .LP
479 \fBpooladm\fR(1M), \fBzoneadm\fR(1M), \fBfpathconf\fR(2), \fBseteuid\fR(2),
480 \fBsetrlimit\fR(2), \fBconfstr\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)
481 .SH NOTES
482 .sp
483 .LP
484 A call to \fBsetrlimit()\fR can cause the value of \fBOPEN_MAX\fR to change.
485 .sp
486 .LP
487 Multiplying \fBsysconf\fR(\fB_SC_PHYS_PAGES\fR) or
488 \fBsysconf\fR(\fB_SC_AVPHYS_PAGES\fR) by \fBsysconf\fR(\fB_SC_PAGESIZE\fR) to
489 determine memory amount in bytes can exceed the maximum values representable in
490 a 32-bit signed or unsigned integer.
491 .sp
492 .LP
493 The value of \fBCLK_TCK\fR can be variable and it should not be assumed that
494 \fBCLK_TCK\fR is a compile-time constant.
495 .sp
496 .LP
497 If the caller is in a non-global zone and the pools facility is active,
498 \fBsysconf\fR(\fB_SC_NPROCESSORS_CONF\fR) and
499 \fBsysconf\fR(\fB_SC_NPROCESSORS_ONLN\fR) return the number of processors in
500 the processor set of the pool to which the zone is bound.