1sysconf(3C)              Standard C Library Functions              sysconf(3C)
2
3
4

NAME

6       sysconf - get configurable system variables
7

SYNOPSIS

9       #include <unistd.h>
10
11       long sysconf(int name);
12
13

DESCRIPTION

15       The  sysconf()  function provides a method for an application to deter‐
16       mine the current value of a configurable system limit or option  (vari‐
17       able).
18
19
20       The  name  argument  represents  the system variable to be queried. The
21       following table lists the minimal set of system  variables  from  <lim‐
22       its.h>  and  <unistd.h>  that can be returned by sysconf() and the sym‐
23       bolic constants defined in <unistd.h> that are the corresponding values
24       used for name on the  SPARC and x86 platforms.
25
26             Name                   Return Value               Meaning
27         _______________________________________________________________________
28         _SC_2_C_BIND            _POSIX2_C_BIND             Supports the C lang-
29                                                            uage binding option
30         _SC_2_C_DEV             _POSIX2_C_DEV              Supports the C lang-
31                                                            uage development
32                                                            utilities option
33         _SC_2_C_VERSION         _POSIX2_C_VERSION          Integer value
34                                                            indicates version
35                                                            of ISO POSIX-2
36                                                            standard (Commands)
37         _SC_2_CHAR_TERM         _POSIX2_CHAR_TERM          Supports at least
38                                                            one terminal
39         _SC_2_FORT_DEV          _POSIX2_FORT_DEV           Supports FORTRAN
40                                                            Development
41                                                            Utilities Option
42         _SC_2_FORT_RUN          _POSIX2_FORT_RUN           Supports FORTRAN
43                                                            Run-time Utilities
44                                                            Option
45         _SC_2_LOCALEDEF         _POSIX2_LOCALEDEF          Supports creation
46                                                            of locales by the
47                                                            localedef utility
48         _SC_2_SW_DEV            _POSIX2_SW_DEV             Supports Software
49                                                            Development Utility
50                                                            Option
51         _SC_2_UPE               _POSIX2_UPE                Supports User
52                                                            Portability
53                                                            Utilities Option
54         _SC_2_VERSION           _POSIX2_VERSION            Integer value
55                                                            indicates version
56                                                            of ISO POSIX-2
57                                                            standard (C language
58                                                            binding)
59         _SC_AIO_LISTIO_MAX      AIO_LISTIO_MAX             Max number of I/O
60                                                            operations in a
61                                                            single list I/O call
62                                                            supported
63         _SC_AIO_MAX             AIO_MAX                    Max number of
64                                                            outstanding
65                                                            asynchronous I/O
66                                                            operations supported
67         _SC_AIO_PRIO_DELTA_MAX  AIO_PRIO_DELTA_MAX         Max amount by which
68                                                            process can decrease
69                                                            its asynchronous
70                                                            I/O priority level
71                                                            from its own
72                                                            scheduling priority
73         _SC_ARG_MAX             ARG_MAX                    Max size of argv[]
74                                                            plus envp[]
75         _SC_ASYNCHRONOUS_IO     _POSIX_ASYNCHRONOUS_IO     Supports
76                                                            Asynchronous I/O
77         _SC_ATEXIT_MAX          ATEXIT_MAX                 Max number of
78                                                            functions that can
79                                                            be registered with
80                                                            atexit()
81         _SC_AVPHYS_PAGES                                   Number of physical
82                                                            memory pages not
83                                                            currently in use by
84                                                            system
85         _SC_BARRIERS            _POSIX_BARRIERS            Supports Barriers
86                                                            option
87         _SC_BC_BASE_MAX         BC_BASE_MAX                Maximum obase values
88                                                            allowed by bc
89         _SC_BC_DIM_MAX          BC_DIM_MAX                 Max number of
90                                                            elements permitted
91                                                            in array by bc
92         _SC_BC_SCALE_MAX        BC_SCALE_MAX               Max scale value
93                                                            allowed by bc
94         _SC_BC_STRING_MAX       BC_STRING_MAX              Max length of string
95                                                            constant allowed by
96                                                            bc
97         _SC_CHILD_MAX           CHILD_MAX                  Max processes
98                                                            allowed to a UID
99         _SC_CLK_TCK             CLK_TCK                    Ticks per second
100                                                            (clock_t)
101         _SC_CLOCK_SELECTION     _POSIX_CLOCK_SELECTION     Supports Clock
102                                                            Selection option
103         _SC_COLL_WEIGHTS_MAX    COLL_WEIGHTS_MAX           Max number of
104                                                            weights that can be
105                                                            assigned to entry of
106                                                            the LC_COLLATE order
107                                                            keyword in locale
108                                                            definition file
109         _SC_CPUID_MAX                                      Max possible
110                                                            processor ID
111         _SC_DELAYTIMER_MAX      DELAYTIMER_MAX             Max number of timer
112                                                            expiration overruns
113         _SC_EXPR_NEST_MAX       EXPR_NEST_MAX              Max number of
114                                                            parentheses by expr
115         _SC_FSYNC               _POSIX_FSYNC               Supports File
116                                                            Synchronization
117         _SC_GETGR_R_SIZE_MAX                               Max size of group
118                                                            entry buffer
119         _SC_GETPW_R_SIZE_MAX                               Max size of password
120                                                            entry buffer
121         _SC_HOST_NAME_MAX       _POSIX_HOST_NAME_MAX       Maximum length of a
122                                                            host name (excluding
123                                                            terminating null)
124         _SC_IOV_MAX             IOV_MAX                    Max number of iovec
125                                                            structures available
126                                                            to one process for
127                                                            use with readv()
128                                                            and writev()
129         _SC_JOB_CONTROL         _POSIX_JOB_CONTROL         Job control
130                                                            supported?
131         _SC_LINE_MAX            LINE_MAX                   Max length of input
132                                                            line
133         _SC_LOGIN_NAME_MAX      LOGNAME_MAX + 1            Max length of login
134                                                            name
135         _SC_LOGNAME_MAX         LOGNAME_MAX
136         _SC_MAPPED_FILES        _POSIX_MAPPED_FILES        Supports Memory
137                                                            Mapped Files
138         _SC_MAXPID                                         Max pid value
139         _SC_MEMLOCK             _POSIX_MEMLOCK             Supports Process
140                                                            Memory Locking
141         _SC_MEMLOCK_RANGE       _POSIX_MEMLOCK_RANGE       Supports Range
142                                                            Memory Locking
143         _SC_MEMORY_PROTECTION   _POSIX_MEMORY_PROTECTION   Supports Memory
144                                                            Protection
145         _SC_MESSAGE_PASSING     _POSIX_MESSAGE_PASSING     Supports Message
146                                                            Passing
147         _SC_MONOTONIC_CLOCK     _POSIX_MONOTONIC_CLOCK     Supports Monotonic
148                                                            Clock option
149         _SC_MQ_OPEN_MAX         MQ_OPEN_MAX                Max number of open
150                                                            message queues a
151                                                            process can hold
152         _SC_MQ_PRIO_MAX         MQ_PRIO_MAX                Max number of
153                                                            message priorities
154                                                            supported
155         _SC_NGROUPS_MAX         NGROUPS_MAX                Max simultaneous
156                                                            groups to which
157                                                            one can belong
158         _SC_NPROCESSORS_CONF                               Number of processors
159                                                            configured
160         _SC_NPROCESSORS_MAX                                Max number of
161                                                            processors supported
162                                                            by platform
163         _SC_NPROCESSORS_ONLN                               Number of processors
164                                                            online
165         _SC_OPEN_MAX            OPEN_MAX                   Max open files per
166                                                            process
167         _SC_PAGESIZE            PAGESIZE                   System memory page
168                                                            size
169         _SC_PAGE_SIZE           PAGESIZE                   Same as _SC_PAGESIZE
170         _SC_PASS_MAX            PASS_MAX                   Max number of
171                                                            significant bytes
172                                                            in a password
173         _SC_PHYS_PAGES                                     Total number of
174                                                            pages of physical
175                                                            memory in system
176         _SC_PRIORITIZED_IO      _POSIX_PRIORITIZED_IO      Supports Prioritized
177                                                            I/O
178         _SC_PRIORITY_SCHEDULING _POSIX_PRIORITY_SCHEDULING Supports Process
179                                                            Scheduling
180         _SC_RAW_SOCKETS         _POSIX_RAW_SOCKETS         Supports Raw Sockets
181                                                            option
182         _SC_RE_DUP_MAX          RE_DUP_MAX                 Max number of
183                                                            repeated occurrences
184                                                            of a regular
185                                                            expression permitted
186                                                            when using interval
187                                                            notation \{m,n\}
188         _SC_READER_WRITER_LOCKS _POSIX_READER_WRITER_LOCKS Supports IPV6 option
189         _SC_REALTIME_SIGNALS    _POSIX_REALTIME_SIGNALS    Supports Realtime
190                                                            Signals
191         _SC_REGEXP              _POSIX_REGEXP              Supports Regular
192                                                            Expression Handling
193                                                            option
194         _SC_RTSIG_MAX           RTSIG_MAX                  Max number of
195                                                            realtime signals
196                                                            reserved for
197                                                            application use
198         _SC_SAVED_IDS           _POSIX_SAVED_IDS           Saved IDs
199                                                            (seteuid())
200                                                            supported?
201         _SC_SEM_NSEMS_MAX       SEM_NSEMS_MAX              Max number of POSIX
202                                                            semaphores a process
203                                                            can have
204         _SC_SEM_VALUE_MAX       SEM_VALUE_MAX              Max value a POSIX
205                                                            semaphore can have
206         _SC_SEMAPHORES          _POSIX_SEMAPHORES          Supports Semaphores
207         _SC_SHARED_MEMORY_      _POSIX_SHARED_MEMORY_      Supports Shared
208            OBJECTS                 OBJECTS                 Memory Objects
209         _SC_SHELL               _POSIX_SHELL               Supports POSIX shell
210         _SC_SIGQUEUE_MAX        SIGQUEUE_MAX               Max number of queued
211                                                            signals that a
212                                                            process can send and
213                                                            have pending at
214                                                            receiver(s) at a
215                                                            time
216         _SC_SPAWN               _POSIX_SPAWN               Supports Spawn option
217         _SC_SPIN_LOCKS          _POSIX_SPIN_LOCKS          Supports Spin Locks
218                                                            option
219         _SC_STACK_PROT                                     Default stack
220                                                            protection
221         _SC_STREAM_MAX          STREAM_MAX                 Number of streams
222                                                            one process can
223                                                            have open at a time
224         _SC_SYMLOOP_MAX         _POSIX_SYMLOOP_MAX         Max number of symbolic
225                                                            links that can be
226                                                            reliably traversed in
227                                                            the resolution of a
228                                                            pathname in the absence
229                                                            of a loop
230         _SC_SYNCHRONIZED_IO     _POSIX_SYNCHRONIZED_IO     Supports
231                                                            Synchronized I/O
232         _SC_THREAD_ATTR_        _POSIX_THREAD_ATTR_        Supports Thread
233            STACKADDR               STACKADDR               Stack Address
234                                                            Attribute option
235         _SC_THREAD_ATTR_        _POSIX_THREAD_ATTR_        Supports Thread
236            STACKSIZE               STACKSIZE               Stack Size
237                                                            Attribute option
238         _SC_THREAD_DESTRUCTOR_  PTHREAD_DESTRUCTOR_        Number attempts made
239            ITERATIONS              ITERATIONS              to destroy thread-
240                                                            specific data on
241                                                            thread exit
242         _SC_THREAD_KEYS_MAX     PTHREAD_KEYS_MAX           Max number of data
243                                                            keys per process
244         _SC_THREAD_PRIO_        _POSIX_THREAD_PRIO_        Supports Priority
245            INHERIT                 INHERIT                 Inheritance option
246         _SC_THREAD_PRIO_        _POSIX_THREAD_PRIO_        Supports Priority
247            PROTECT                 PROTECT                 Protection option
248         _SC_THREAD_PRIORITY_    _POSIX_THREAD_PRIORITY_    Supports Thread
249            SCHEDULING              SCHEDULING              Execution
250                                                            Scheduling option
251         _SC_THREAD_PROCESS_     _POSIX_THREAD_PROCESS_     Supports
252            SHARED                  SHARED                  Process-Shared
253                                                            Synchronization
254                                                            option
255         _SC_THREAD_SAFE_        _POSIX_THREAD_SAFE_        Supports Thread-Safe
256            FUNCTIONS               FUNCTIONS               Functions option
257         _SC_THREAD_STACK_MIN    PTHREAD_STACK_MIN          Min byte size of
258                                                            thread stack storage
259         _SC_THREAD_THREADS_MAX  PTHREAD_THREADS_MAX        Max number of
260                                                            threads per process
261         _SC_THREADS             _POSIX_THREADS             Supports Threads
262                                                            option
263         _SC_TIMEOUTS            _POSIX_TIMEOUTS            Supports Timeouts
264                                                            option
265         _SC_TIMER_MAX           TIMER_MAX                  Max number of timer
266                                                            per process
267                                                            supported
268         _SC_TIMERS              _POSIX_TIMERS              Supports Timers
269         _SC_TTY_NAME_MAX        TTYNAME_MAX                Max length of tty
270                                                            device name
271         _SC_TZNAME_MAX          TZNAME_MAX                 Max number of bytes
272                                                            supported for name
273                                                            of a time zone
274         _SC_V6_ILP32_OFF32      _POSIX_V6_ILP32_OFF32      Supports  X/Open
275                                                            ILP32 w/32-bit
276                                                            offset build
277                                                            environment
278         _SC_V6_ILP32_OFFBIG     _POSIX_V6_ILP32_OFFBIG     Supports  X/Open
279                                                            ILP32 w/64-bit
280                                                            offset build
281                                                            environment
282         _SC_V6_LP64_OFF64       _POSIX_V6_LP64_OFF64       Supports  X/Open
283                                                            LP64 w/64-bit
284                                                            offset build
285                                                            environment
286         _SC_V6_LPBIG_OFFBIG     _POSIX_V6_LPBIG_OFFBIG     Same as
287                                                            _SC_V6_LP64_OFF64
288         _SC_VERSION             _POSIX_VERSION             POSIX.1 version
289                                                            supported
290         _SC_XBS5_ILP32_OFF32    _XBS_ILP32_OFF32           Indicates support
291                                                            for X/Open ILP32
292                                                            w/32-bit offset
293                                                            build environment
294         _SC_XBS5_ILP32_OFFBIG   _XBS5_ILP32_OFFBIG         Indicates support
295                                                            for X/Open ILP32
296                                                            w/64-bit offset
297                                                            build environment
298         _SC_XBS5_LP64_OFF64     _XBS5_LP64_OFF64           Indicates support of
299                                                            X/Open LP64,
300                                                            64-bit offset
301                                                            build environment
302         _SC_XBS5_LPBIG_OFFBIG   _XBS5_LP64_OFF64           Same as
303                                                            _SC_XBS5_LP64_OFF64
304         _SC_XOPEN_CRYPT         _XOPEN_CRYPT               Supports X/Open
305                                                            Encryption Feature
306                                                            Group
307         _SC_XOPEN_ENH_I18N      _XOPEN_ENH_I18N            Supports X/Open
308                                                            Enhanced
309                                                            Internationalization
310                                                            Feature Group
311         _SC_XOPEN_LEGACY        _XOPEN_LEGACY              Supports X/Open
312                                                            Legacy Feature Group
313         _SC_XOPEN_REALTIME      _XOPEN_REALTIME            Supports X/Open
314                                                            POSIX Realtime
315                                                            Feature Group
316         _SC_XOPEN_REALTIME_     _XOPEN_REALTIME_THREADS    Supports X/Open
317              THREADS                                       POSIX Reatime
318                                                            Threads Feature
319                                                            Group
320         _SC_XOPEN_SHM           _XOPEN_SHM                 Supports X/Open
321                                                            Shared Memory
322                                                            Feature Group
323         _SC_XOPEN_STREAMS       _POSIX_XOPEN_STREAMS       Supports XSI Streams
324                                                            option group
325         _SC_XOPEN_UNIX          _XOPEN_UNIX                Supports X/Open CAE
326                                                            Specification,
327                                                            August 1994, System
328                                                            Interfaces and
329                                                            Headers, Issue 4,
330                                                            Version 2
331         _SC_XOPEN_VERSION       _XOPEN_VERSION             Integer value
332                                                            indicates version of
333                                                            X/Open Portability
334                                                            Guide to which
335                                                            implementation
336                                                            conforms
337         _SC_XOPEN_XCU_VERSION   _XOPEN_XCU_VERSION         Integer value
338                                                            indicates version of
339                                                            XCU specification to
340                                                            which implementation
341                                                            conforms
342
343
344
345
346       The following options are not supported and return −1:
347
348
349
350
351       _SC_2_PBS                     _POSIX2_PBS
352       _SC_2_PBS_ACCOUNTING          _POSIX2_PBS_ACCOUNTING
353       _SC_2_PBS_CHECKPOINT          _POSIX2_PBS_CHECKPOINT
354       _SC_2_PBS_LOCATE              _POSIX2_PBS_LOCATE
355       _SC_2_PBS_MESSAGE             _POSIX2_PBS_MESSAGE
356       _SC_2_PBS_TRACK               _POSIX2_PBS_TRACK
357       _SC_ADVISORY_INFO             _POSIX_ADVISORY_INFO
358       _SC_CPUTIME                   _POSIX_CPUTIME
359       _SC_SPORADIC_SERVER           _POSIX_SPORADIC_SERVER
360       _SC_SS_REPL_MAX               _POSIX_SS_REPL_MAX
361       _SC_THREAD_CPUTIME            _POSIX_THREAD_CPUTIME
362       _SC_THREAD_SPORADIC_SERVER    _POSIX_THREAD_SPORADIC_SERVER
363       _SC_TRACE                     _POSIX_TRACE
364       _SC_TRACE_EVENT_FILTER        _POSIX_TRACE_EVENT_FILTER
365       _SC_TRACE_EVENT_NAME_MAX      _POSIX_TRACE_EVENT_NAME_MAX
366       _SC_TRACE_INHERIT             _POSIX_TRACE_INHERIT
367       _SC_TRACE_LOG                 _POSIX_TRACE_LOG
368       _SC_TRACE_NAME_MAX            _POSIX_TRACE_NAME_MAX
369       _SC_TRACE_SYS_MAX             _POSIX_TRACE_SYS_MAX
370       _SC_TRACE_USER_EVENT_MAX      _POSIX_TRACE_USER_EVENT_MAX
371       _SC_TYPED_MEMORY_OBJECTS      _POSIX_TYPED_MEMORY_OBJECTS
372
373

RETURN VALUES

375       Upon  successful  completion,  sysconf()  returns  the current variable
376       value on the system. The value returned will not  be  more  restrictive
377       than  the  corresponding value described to the application when it was
378       compiled with the implementation's <limits.h>, <unistd.h> or  <time.h>.
379       With  only  a  few  obvious  exceptions  such  as  _SC_AVPHYS_PAGES and
380       _SC_NPROCESSORS_ONLN, the value will not change during the lifetime  of
381       the calling process.
382
383
384       If  name  is  an  invalid value, sysconf() returns −1 and sets errno to
385       indicate the error. If the variable corresponding to name is associated
386       with  functionality  that  is  not  supported  by the system, sysconf()
387       returns −1 without changing the value of errno.
388
389
390       Calling sysconf() with the following returns −1 without setting  errno,
391       because  no  maximum  limit  can  be determined. The system supports at
392       least the minimum values and can support higher values  depending  upon
393       system resources.
394
395         Variable                            Minimum supported value
396         _SC_AIO_MAX                        _POSIX_AIO_MAX
397         _SC_ATEXIT_MAX                     32
398         _SC_MQ_OPEN_MAX                    32
399         _SC_THREAD_THREADS_MAX             _POSIX_THREAD_THREADS_MAX
400         _SC_THREAD_KEYS_MAX                _POSIX_THREAD_KEYS_MAX
401         _SC_THREAD_DESTRUCTOR_ITERATIONS   _POSIX_THREAD_DESTRUCTOR_ITERATIONS
402
403
404
405       The following SPARC and x86 platform variables return EINVAL:
406
407         _SC_COHER_BLKSZ        _SC_DCACHE_ASSOC
408         _SC_DCACHE_BLKSZ       _SC_DCACHE_LINESZ
409         _SC_DCACHE_SZ          _SC_DCACHE_TBLKSZ
410         _SC_ICACHE_ASSOC       _SC_ICACHE_BLKSZ
411         _SC_ICACHE_LINESZ      _SC_ICACHE_SZ
412         _SC_SPLIT_CACHE
413
414

ERRORS

416       The sysconf() function will fail if:
417
418       EINVAL    The value of the name argument is invalid.
419
420

ATTRIBUTES

422       See attributes(5) for descriptions of the following attributes:
423
424
425
426
427       ┌─────────────────────────────┬─────────────────────────────┐
428       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
429       ├─────────────────────────────┼─────────────────────────────┤
430       │Architecture                 │SPARC and x86                │
431       ├─────────────────────────────┼─────────────────────────────┤
432       │Interface Stability          │Committed                    │
433       ├─────────────────────────────┼─────────────────────────────┤
434       │MT-Level                     │MT-Safe, Async-Signal-Safe   │
435       ├─────────────────────────────┼─────────────────────────────┤
436       │Standard                     │See standards(5).            │
437       └─────────────────────────────┴─────────────────────────────┘
438

SEE ALSO

440       pooladm(1M), zoneadm(1M), fpathconf(2), seteuid(2), setrlimit(2), conf‐
441       str(3C), attributes(5), standards(5)
442

NOTES

444       A call to setrlimit() can cause the value of OPEN_MAX to change.
445
446
447       Multiplying  sysconf(_SC_PHYS_PAGES)  or  sysconf(_SC_AVPHYS_PAGES)  by
448       sysconf(_SC_PAGESIZE)  to  determine  memory amount in bytes can exceed
449       the maximum values representable in a 32-bit signed or  unsigned  inte‐
450       ger.
451
452
453       The  value of CLK_TCK can be variable and it should not be assumed that
454       CLK_TCK is a compile-time constant.
455
456
457       If the caller is in a non-global zone and the pools facility is active,
458       sysconf(_SC_NPROCESSORS_CONF)  and sysconf(_SC_NPROCESSORS_ONLN) return
459       the number of processors in the processor set of the pool to which  the
460       zone is bound.
461
462
463
464SunOS 5.11                        26 Mar 2008                      sysconf(3C)
Impressum