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