1 @node System Configuration, Cryptographic Functions, System Management, Top
2 @c %MENU% Parameters describing operating system limits
3 @chapter System Configuration Parameters
5 The functions and macros listed in this chapter give information about
6 configuration parameters of the operating system---for example, capacity
7 limits, presence of optional POSIX features, and the default path for
8 executable files (@pxref{String Parameters}).
11 * General Limits:: Constants and functions that describe
12 various process-related limits that have
13 one uniform value for any given machine.
14 * System Options:: Optional POSIX features.
15 * Version Supported:: Version numbers of POSIX.1 and POSIX.2.
16 * Sysconf:: Getting specific configuration values
17 of general limits and system options.
18 * Minimums:: Minimum values for general limits.
20 * Limits for Files:: Size limitations that pertain to individual files.
21 These can vary between file systems
22 or even from file to file.
23 * Options for Files:: Optional features that some files may support.
24 * File Minimums:: Minimum values for file limits.
25 * Pathconf:: Getting the limit values for a particular file.
27 * Utility Limits:: Capacity limits of some POSIX.2 utility programs.
28 * Utility Minimums:: Minimum allowable values of those limits.
30 * String Parameters:: Getting the default search path.
34 @section General Capacity Limits
35 @cindex POSIX capacity limits
37 @cindex capacity limits, POSIX
39 The POSIX.1 and POSIX.2 standards specify a number of parameters that
40 describe capacity limitations of the system. These limits can be fixed
41 constants for a given operating system, or they can vary from machine to
42 machine. For example, some limit values may be configurable by the
43 system administrator, either at run time or by rebuilding the kernel,
44 and this should not require recompiling application programs.
47 Each of the following limit parameters has a macro that is defined in
48 @file{limits.h} only if the system has a fixed, uniform limit for the
49 parameter in question. If the system allows different file systems or
50 files to have different limits, then the macro is undefined; use
51 @code{sysconf} to find out the limit that applies at a particular time
52 on a particular machine. @xref{Sysconf}.
54 Each of these parameters also has another macro, with a name starting
55 with @samp{_POSIX}, which gives the lowest value that the limit is
56 allowed to have on @emph{any} POSIX system. @xref{Minimums}.
58 @cindex limits, program argument size
59 @deftypevr Macro int ARG_MAX
60 @standards{POSIX.1, limits.h}
61 If defined, the unvarying maximum combined length of the @var{argv} and
62 @var{environ} arguments that can be passed to the @code{exec} functions.
65 @cindex limits, number of processes
66 @deftypevr Macro int CHILD_MAX
67 @standards{POSIX.1, limits.h}
68 If defined, the unvarying maximum number of processes that can exist
69 with the same real user ID at any one time. In BSD and GNU, this is
70 controlled by the @code{RLIMIT_NPROC} resource limit; @pxref{Limits on
74 @cindex limits, number of open files
75 @deftypevr Macro int OPEN_MAX
76 @standards{POSIX.1, limits.h}
77 If defined, the unvarying maximum number of files that a single process
78 can have open simultaneously. In BSD and GNU, this is controlled
79 by the @code{RLIMIT_NOFILE} resource limit; @pxref{Limits on Resources}.
82 @deftypevr Macro int STREAM_MAX
83 @standards{POSIX.1, limits.h}
84 If defined, the unvarying maximum number of streams that a single
85 process can have open simultaneously. @xref{Opening Streams}.
88 @cindex limits, time zone name length
89 @deftypevr Macro int TZNAME_MAX
90 @standards{POSIX.1, limits.h}
91 If defined, the unvarying maximum length of a time zone name.
92 @xref{Time Zone Functions}.
95 These limit macros are always defined in @file{limits.h}.
97 @cindex limits, number of supplementary group IDs
98 @deftypevr Macro int NGROUPS_MAX
99 @standards{POSIX.1, limits.h}
100 The maximum number of supplementary group IDs that one process can have.
102 The value of this macro is actually a lower bound for the maximum. That
103 is, you can count on being able to have that many supplementary group
104 IDs, but a particular machine might let you have even more. You can use
105 @code{sysconf} to see whether a particular machine will let you have
106 more (@pxref{Sysconf}).
109 @deftypevr Macro ssize_t SSIZE_MAX
110 @standards{POSIX.1, limits.h}
111 The largest value that can fit in an object of type @code{ssize_t}.
112 Effectively, this is the limit on the number of bytes that can be read
113 or written in a single operation.
115 This macro is defined in all POSIX systems because this limit is never
119 @deftypevr Macro int RE_DUP_MAX
120 @standards{POSIX.2, limits.h}
121 The largest number of repetitions you are guaranteed is allowed in the
122 construct @samp{\@{@var{min},@var{max}\@}} in a regular expression.
124 The value of this macro is actually a lower bound for the maximum. That
125 is, you can count on being able to have that many repetitions, but a
126 particular machine might let you have even more. You can use
127 @code{sysconf} to see whether a particular machine will let you have
128 more (@pxref{Sysconf}). And even the value that @code{sysconf} tells
129 you is just a lower bound---larger values might work.
131 This macro is defined in all POSIX.2 systems, because POSIX.2 says it
132 should always be defined even if there is no specific imposed limit.
136 @section Overall System Options
137 @cindex POSIX optional features
138 @cindex optional POSIX features
140 POSIX defines certain system-specific options that not all POSIX systems
141 support. Since these options are provided in the kernel, not in the
142 library, simply using @theglibc{} does not guarantee any of these
143 features are supported; it depends on the system you are using.
146 You can test for the availability of a given option using the macros in
147 this section, together with the function @code{sysconf}. The macros are
148 defined only if you include @file{unistd.h}.
150 For the following macros, if the macro is defined in @file{unistd.h},
151 then the option is supported. Otherwise, the option may or may not be
152 supported; use @code{sysconf} to find out. @xref{Sysconf}.
154 @deftypevr Macro int _POSIX_JOB_CONTROL
155 @standards{POSIX.1, unistd.h}
156 If this symbol is defined, it indicates that the system supports job
157 control. Otherwise, the implementation behaves as if all processes
158 within a session belong to a single process group. @xref{Job Control}.
161 @deftypevr Macro int _POSIX_SAVED_IDS
162 @standards{POSIX.1, unistd.h}
163 If this symbol is defined, it indicates that the system remembers the
164 effective user and group IDs of a process before it executes an
165 executable file with the set-user-ID or set-group-ID bits set, and that
166 explicitly changing the effective user or group IDs back to these values
167 is permitted. If this option is not defined, then if a nonprivileged
168 process changes its effective user or group ID to the real user or group
169 ID of the process, it can't change it back again. @xref{Enable/Disable
173 For the following macros, if the macro is defined in @file{unistd.h},
174 then its value indicates whether the option is supported. A value of
175 @code{-1} means no, and any other value means yes. If the macro is not
176 defined, then the option may or may not be supported; use @code{sysconf}
177 to find out. @xref{Sysconf}.
179 @deftypevr Macro int _POSIX2_C_DEV
180 @standards{POSIX.2, unistd.h}
181 If this symbol is defined, it indicates that the system has the POSIX.2
182 C compiler command, @code{c89}. @Theglibc{} always defines this
183 as @code{1}, on the assumption that you would not have installed it if
184 you didn't have a C compiler.
187 @deftypevr Macro int _POSIX2_FORT_DEV
188 @standards{POSIX.2, unistd.h}
189 If this symbol is defined, it indicates that the system has the POSIX.2
190 Fortran compiler command, @code{fort77}. @Theglibc{} never
191 defines this, because we don't know what the system has.
194 @deftypevr Macro int _POSIX2_FORT_RUN
195 @standards{POSIX.2, unistd.h}
196 If this symbol is defined, it indicates that the system has the POSIX.2
197 @code{asa} command to interpret Fortran carriage control. @Theglibc{}
198 never defines this, because we don't know what the system has.
201 @deftypevr Macro int _POSIX2_LOCALEDEF
202 @standards{POSIX.2, unistd.h}
203 If this symbol is defined, it indicates that the system has the POSIX.2
204 @code{localedef} command. @Theglibc{} never defines this, because
205 we don't know what the system has.
208 @deftypevr Macro int _POSIX2_SW_DEV
209 @standards{POSIX.2, unistd.h}
210 If this symbol is defined, it indicates that the system has the POSIX.2
211 commands @code{ar}, @code{make}, and @code{strip}. @Theglibc{}
212 always defines this as @code{1}, on the assumption that you had to have
213 @code{ar} and @code{make} to install the library, and it's unlikely that
214 @code{strip} would be absent when those are present.
217 @node Version Supported
218 @section Which Version of POSIX is Supported
220 @deftypevr Macro {long int} _POSIX_VERSION
221 @standards{POSIX.1, unistd.h}
222 This constant represents the version of the POSIX.1 standard to which
223 the implementation conforms. For an implementation conforming to the
224 1995 POSIX.1 standard, the value is the integer @code{199506L}.
226 @code{_POSIX_VERSION} is always defined (in @file{unistd.h}) in any
229 @strong{Usage Note:} Don't try to test whether the system supports POSIX
230 by including @file{unistd.h} and then checking whether
231 @code{_POSIX_VERSION} is defined. On a non-POSIX system, this will
232 probably fail because there is no @file{unistd.h}. We do not know of
233 @emph{any} way you can reliably test at compilation time whether your
234 target system supports POSIX or whether @file{unistd.h} exists.
237 @deftypevr Macro {long int} _POSIX2_C_VERSION
238 @standards{POSIX.2, unistd.h}
239 This constant represents the version of the POSIX.2 standard which the
240 library and system kernel support. We don't know what value this will
241 be for the first version of the POSIX.2 standard, because the value is
242 based on the year and month in which the standard is officially adopted.
244 The value of this symbol says nothing about the utilities installed on
247 @strong{Usage Note:} You can use this macro to tell whether a POSIX.1
248 system library supports POSIX.2 as well. Any POSIX.1 system contains
249 @file{unistd.h}, so include that file and then test @code{defined
250 (_POSIX2_C_VERSION)}.
254 @section Using @code{sysconf}
256 When your system has configurable system limits, you can use the
257 @code{sysconf} function to find out the value that applies to any
258 particular machine. The function and the associated @var{parameter}
259 constants are declared in the header file @file{unistd.h}.
262 * Sysconf Definition:: Detailed specifications of @code{sysconf}.
263 * Constants for Sysconf:: The list of parameters @code{sysconf} can read.
264 * Examples of Sysconf:: How to use @code{sysconf} and the parameter
265 macros properly together.
268 @node Sysconf Definition
269 @subsection Definition of @code{sysconf}
271 @deftypefun {long int} sysconf (int @var{parameter})
272 @standards{POSIX.1, unistd.h}
273 @safety{@prelim{}@mtsafe{@mtsenv{}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{} @acsfd{}}}
274 @c Some parts of the implementation open /proc and /sys files and dirs
275 @c to collect system details, using fd and stream I/O depending on the
276 @c case. The returned max value may change over time for NPROCS,
277 @c NPROCS_CONF, PHYS_PAGES, AVPHYS_PAGES, NGROUPS_MAX, SIGQUEUE_MAX,
278 @c depending on variable values read from /proc at each call, and from
279 @c rlimit-obtained values CHILD_MAX, OPEN_MAX, ARG_MAX, SIGQUEUE_MAX.
280 This function is used to inquire about runtime system parameters. The
281 @var{parameter} argument should be one of the @samp{_SC_} symbols listed
284 The normal return value from @code{sysconf} is the value you requested.
285 A value of @code{-1} is returned both if the implementation does not
286 impose a limit, and in case of an error.
288 The following @code{errno} error conditions are defined for this function:
292 The value of the @var{parameter} is invalid.
296 @node Constants for Sysconf
297 @subsection Constants for @code{sysconf} Parameters
299 Here are the symbolic constants for use as the @var{parameter} argument
300 to @code{sysconf}. The values are all integer constants (more
301 specifically, enumeration type values).
305 @standards{POSIX.1, unistd.h}
306 Inquire about the parameter corresponding to @code{ARG_MAX}.
309 @standards{POSIX.1, unistd.h}
310 Inquire about the parameter corresponding to @code{CHILD_MAX}.
313 @standards{POSIX.1, unistd.h}
314 Inquire about the parameter corresponding to @code{OPEN_MAX}.
317 @standards{POSIX.1, unistd.h}
318 Inquire about the parameter corresponding to @code{STREAM_MAX}.
321 @standards{POSIX.1, unistd.h}
322 Inquire about the parameter corresponding to @code{TZNAME_MAX}.
324 @item _SC_NGROUPS_MAX
325 @standards{POSIX.1, unistd.h}
326 Inquire about the parameter corresponding to @code{NGROUPS_MAX}.
328 @item _SC_JOB_CONTROL
329 @standards{POSIX.1, unistd.h}
330 Inquire about the parameter corresponding to @code{_POSIX_JOB_CONTROL}.
333 @standards{POSIX.1, unistd.h}
334 Inquire about the parameter corresponding to @code{_POSIX_SAVED_IDS}.
337 @standards{POSIX.1, unistd.h}
338 Inquire about the parameter corresponding to @code{_POSIX_VERSION}.
341 @standards{POSIX.1, unistd.h}
342 Inquire about the number of clock ticks per second; @pxref{CPU Time}.
343 The corresponding parameter @code{CLK_TCK} is obsolete.
345 @item _SC_CHARCLASS_NAME_MAX
346 @standards{GNU, unistd.h}
347 Inquire about the parameter corresponding to maximal length allowed for
348 a character class name in an extended locale specification. These
349 extensions are not yet standardized and so this option is not standardized
352 @item _SC_REALTIME_SIGNALS
353 @standards{POSIX.1, unistdh.h}
354 Inquire about the parameter corresponding to @code{_POSIX_REALTIME_SIGNALS}.
356 @item _SC_PRIORITY_SCHEDULING
357 @standards{POSIX.1, unistd.h}
358 Inquire about the parameter corresponding to @code{_POSIX_PRIORITY_SCHEDULING}.
361 @standards{POSIX.1, unistd.h}
362 Inquire about the parameter corresponding to @code{_POSIX_TIMERS}.
364 @item _SC_ASYNCHRONOUS_IO
365 @standards{POSIX.1, unistd.h}
366 Inquire about the parameter corresponding to @code{_POSIX_ASYNCHRONOUS_IO}.
368 @item _SC_PRIORITIZED_IO
369 @standards{POSIX.1, unistd.h}
370 Inquire about the parameter corresponding to @code{_POSIX_PRIORITIZED_IO}.
372 @item _SC_SYNCHRONIZED_IO
373 @standards{POSIX.1, unistd.h}
374 Inquire about the parameter corresponding to @code{_POSIX_SYNCHRONIZED_IO}.
377 @standards{POSIX.1, unistd.h}
378 Inquire about the parameter corresponding to @code{_POSIX_FSYNC}.
380 @item _SC_MAPPED_FILES
381 @standards{POSIX.1, unistd.h}
382 Inquire about the parameter corresponding to @code{_POSIX_MAPPED_FILES}.
385 @standards{POSIX.1, unistd.h}
386 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK}.
388 @item _SC_MEMLOCK_RANGE
389 @standards{POSIX.1, unistd.h}
390 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK_RANGE}.
392 @item _SC_MEMORY_PROTECTION
393 @standards{POSIX.1, unistd.h}
394 Inquire about the parameter corresponding to @code{_POSIX_MEMORY_PROTECTION}.
396 @item _SC_MESSAGE_PASSING
397 @standards{POSIX.1, unistd.h}
398 Inquire about the parameter corresponding to @code{_POSIX_MESSAGE_PASSING}.
401 @standards{POSIX.1, unistd.h}
402 Inquire about the parameter corresponding to @code{_POSIX_SEMAPHORES}.
404 @item _SC_SHARED_MEMORY_OBJECTS
405 @standards{POSIX.1, unistd.h}
406 Inquire about the parameter corresponding to@*
407 @code{_POSIX_SHARED_MEMORY_OBJECTS}.
409 @item _SC_AIO_LISTIO_MAX
410 @standards{POSIX.1, unistd.h}
411 Inquire about the parameter corresponding to @code{_POSIX_AIO_LISTIO_MAX}.
414 @standards{POSIX.1, unistd.h}
415 Inquire about the parameter corresponding to @code{_POSIX_AIO_MAX}.
417 @item _SC_AIO_PRIO_DELTA_MAX
418 @standards{POSIX.1, unistd.h}
419 Inquire about the value by which a process can decrease its asynchronous I/O
420 priority level from its own scheduling priority. This corresponds to the
421 run-time invariant value @code{AIO_PRIO_DELTA_MAX}.
423 @item _SC_DELAYTIMER_MAX
424 @standards{POSIX.1, unistd.h}
425 Inquire about the parameter corresponding to @code{_POSIX_DELAYTIMER_MAX}.
427 @item _SC_MQ_OPEN_MAX
428 @standards{POSIX.1, unistd.h}
429 Inquire about the parameter corresponding to @code{_POSIX_MQ_OPEN_MAX}.
431 @item _SC_MQ_PRIO_MAX
432 @standards{POSIX.1, unistd.h}
433 Inquire about the parameter corresponding to @code{_POSIX_MQ_PRIO_MAX}.
436 @standards{POSIX.1, unistd.h}
437 Inquire about the parameter corresponding to @code{_POSIX_RTSIG_MAX}.
439 @item _SC_SEM_NSEMS_MAX
440 @standards{POSIX.1, unistd.h}
441 Inquire about the parameter corresponding to @code{_POSIX_SEM_NSEMS_MAX}.
443 @item _SC_SEM_VALUE_MAX
444 @standards{POSIX.1, unistd.h}
445 Inquire about the parameter corresponding to @code{_POSIX_SEM_VALUE_MAX}.
447 @item _SC_SIGQUEUE_MAX
448 @standards{POSIX.1, unistd.h}
449 Inquire about the parameter corresponding to @code{_POSIX_SIGQUEUE_MAX}.
452 @standards{POSIX.1, unistd.h}
453 Inquire about the parameter corresponding to @code{_POSIX_TIMER_MAX}.
456 @standards{POSIX.1g, unistd.h}
457 Inquire about the parameter corresponding to @code{_POSIX_PII}.
460 @standards{POSIX.1g, unistd.h}
461 Inquire about the parameter corresponding to @code{_POSIX_PII_XTI}.
464 @standards{POSIX.1g, unistd.h}
465 Inquire about the parameter corresponding to @code{_POSIX_PII_SOCKET}.
467 @item _SC_PII_INTERNET
468 @standards{POSIX.1g, unistd.h}
469 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET}.
472 @standards{POSIX.1g, unistd.h}
473 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI}.
476 @standards{POSIX.1g, unistd.h}
477 Inquire about the parameter corresponding to @code{_POSIX_SELECT}.
480 @standards{POSIX.1g, unistd.h}
481 Inquire about the parameter corresponding to @code{_POSIX_UIO_MAXIOV}.
483 @item _SC_PII_INTERNET_STREAM
484 @standards{POSIX.1g, unistd.h}
485 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_STREAM}.
487 @item _SC_PII_INTERNET_DGRAM
488 @standards{POSIX.1g, unistd.h}
489 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_DGRAM}.
491 @item _SC_PII_OSI_COTS
492 @standards{POSIX.1g, unistd.h}
493 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_COTS}.
495 @item _SC_PII_OSI_CLTS
496 @standards{POSIX.1g, unistd.h}
497 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_CLTS}.
500 @standards{POSIX.1g, unistd.h}
501 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_M}.
504 @standards{POSIX.1g, unistd.h}
505 Inquire about the value associated with the @code{T_IOV_MAX}
509 @standards{POSIX.1, unistd.h}
510 Inquire about the parameter corresponding to @code{_POSIX_THREADS}.
512 @item _SC_THREAD_SAFE_FUNCTIONS
513 @standards{POSIX.1, unistd.h}
514 Inquire about the parameter corresponding to@*
515 @code{_POSIX_THREAD_SAFE_FUNCTIONS}.
517 @item _SC_GETGR_R_SIZE_MAX
518 @standards{POSIX.1, unistd.h}
519 Inquire about the parameter corresponding to @code{_POSIX_GETGR_R_SIZE_MAX}.
521 @item _SC_GETPW_R_SIZE_MAX
522 @standards{POSIX.1, unistd.h}
523 Inquire about the parameter corresponding to @code{_POSIX_GETPW_R_SIZE_MAX}.
525 @item _SC_LOGIN_NAME_MAX
526 @standards{POSIX.1, unistd.h}
527 Inquire about the parameter corresponding to @code{_POSIX_LOGIN_NAME_MAX}.
529 @item _SC_TTY_NAME_MAX
530 @standards{POSIX.1, unistd.h}
531 Inquire about the parameter corresponding to @code{_POSIX_TTY_NAME_MAX}.
533 @item _SC_THREAD_DESTRUCTOR_ITERATIONS
534 @standards{POSIX.1, unistd.h}
535 Inquire about the parameter corresponding to
536 @code{_POSIX_THREAD_DESTRUCTOR_ITERATIONS}.
538 @item _SC_THREAD_KEYS_MAX
539 @standards{POSIX.1, unistd.h}
540 Inquire about the parameter corresponding to @code{_POSIX_THREAD_KEYS_MAX}.
542 @item _SC_THREAD_STACK_MIN
543 @standards{POSIX.1, unistd.h}
544 Inquire about the parameter corresponding to @code{_POSIX_THREAD_STACK_MIN}.
546 @item _SC_THREAD_THREADS_MAX
547 @standards{POSIX.1, unistd.h}
548 Inquire about the parameter corresponding to @code{_POSIX_THREAD_THREADS_MAX}.
550 @item _SC_THREAD_ATTR_STACKADDR
551 @standards{POSIX.1, unistd.h}
552 Inquire about the parameter corresponding to@*a
553 @code{_POSIX_THREAD_ATTR_STACKADDR}.
555 @item _SC_THREAD_ATTR_STACKSIZE
556 @standards{POSIX.1, unistd.h}
557 Inquire about the parameter corresponding to@*
558 @code{_POSIX_THREAD_ATTR_STACKSIZE}.
560 @item _SC_THREAD_PRIORITY_SCHEDULING
561 @standards{POSIX.1, unistd.h}
562 Inquire about the parameter corresponding to
563 @code{_POSIX_THREAD_PRIORITY_SCHEDULING}.
565 @item _SC_THREAD_PRIO_INHERIT
566 @standards{POSIX.1, unistd.h}
567 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_INHERIT}.
569 @item _SC_THREAD_PRIO_PROTECT
570 @standards{POSIX.1, unistd.h}
571 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_PROTECT}.
573 @item _SC_THREAD_PROCESS_SHARED
574 @standards{POSIX.1, unistd.h}
575 Inquire about the parameter corresponding to
576 @code{_POSIX_THREAD_PROCESS_SHARED}.
579 @standards{POSIX.2, unistd.h}
580 Inquire about whether the system has the POSIX.2 C compiler command,
584 @standards{POSIX.2, unistd.h}
585 Inquire about whether the system has the POSIX.2 Fortran compiler
586 command, @code{fort77}.
589 @standards{POSIX.2, unistd.h}
590 Inquire about whether the system has the POSIX.2 @code{asa} command to
591 interpret Fortran carriage control.
593 @item _SC_2_LOCALEDEF
594 @standards{POSIX.2, unistd.h}
595 Inquire about whether the system has the POSIX.2 @code{localedef}
599 @standards{POSIX.2, unistd.h}
600 Inquire about whether the system has the POSIX.2 commands @code{ar},
601 @code{make}, and @code{strip}.
603 @item _SC_BC_BASE_MAX
604 @standards{POSIX.2, unistd.h}
605 Inquire about the maximum value of @code{obase} in the @code{bc}
609 @standards{POSIX.2, unistd.h}
610 Inquire about the maximum size of an array in the @code{bc}
613 @item _SC_BC_SCALE_MAX
614 @standards{POSIX.2, unistd.h}
615 Inquire about the maximum value of @code{scale} in the @code{bc}
618 @item _SC_BC_STRING_MAX
619 @standards{POSIX.2, unistd.h}
620 Inquire about the maximum size of a string constant in the
623 @item _SC_COLL_WEIGHTS_MAX
624 @standards{POSIX.2, unistd.h}
625 Inquire about the maximum number of weights that can necessarily
626 be used in defining the collating sequence for a locale.
628 @item _SC_EXPR_NEST_MAX
629 @standards{POSIX.2, unistd.h}
630 Inquire about the maximum number of expressions nested within
631 parentheses when using the @code{expr} utility.
634 @standards{POSIX.2, unistd.h}
635 Inquire about the maximum size of a text line that the POSIX.2 text
636 utilities can handle.
638 @item _SC_EQUIV_CLASS_MAX
639 @standards{POSIX.2, unistd.h}
640 Inquire about the maximum number of weights that can be assigned to an
641 entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale
642 definition. @Theglibc{} does not presently support locale
646 @standards{POSIX.2, unistd.h}
647 Inquire about the version number of POSIX.1 that the library and kernel
651 @standards{POSIX.2, unistd.h}
652 Inquire about the version number of POSIX.2 that the system utilities
656 @standards{GNU, unistd.h}
657 Inquire about the virtual memory page size of the machine.
658 @code{getpagesize} returns the same value (@pxref{Query Memory Parameters}).
660 @item _SC_NPROCESSORS_CONF
661 @standards{GNU, unistd.h}
662 Inquire about the number of configured processors.
664 @item _SC_NPROCESSORS_ONLN
665 @standards{GNU, unistd.h}
666 Inquire about the number of processors online.
669 @standards{GNU, unistd.h}
670 Inquire about the number of physical pages in the system.
672 @item _SC_AVPHYS_PAGES
673 @standards{GNU, unistd.h}
674 Inquire about the number of available physical pages in the system.
677 @standards{GNU, unistd.h}
678 Inquire about the number of functions which can be registered as termination
679 functions for @code{atexit}; @pxref{Cleanups on Exit}.
681 @item _SC_LEVEL1_ICACHE_SIZE
682 @standards{GNU, unistd.h}
683 Inquire about the size of the Level 1 instruction cache.
685 @item _SC_LEVEL1_ICACHE_ASSOC
686 @standards{GNU, unistd.h}
687 Inquire about the associativity of the Level 1 instruction cache.
689 @item _SC_LEVEL1_ICACHE_LINESIZE
690 @standards{GNU, unistd.h}
691 Inquire about the line length of the Level 1 instruction cache.
693 On aarch64, the cache line size returned is the minimum instruction cache line
694 size observable by userspace. This is typically the same as the L1 icache
695 size but on some cores it may not be so. However, it is specified in the
696 architecture that operations such as cache line invalidation are consistent
697 with the size reported with this variable.
699 @item _SC_LEVEL1_DCACHE_SIZE
700 @standards{GNU, unistd.h}
701 Inquire about the size of the Level 1 data cache.
703 @item _SC_LEVEL1_DCACHE_ASSOC
704 @standards{GNU, unistd.h}
705 Inquire about the associativity of the Level 1 data cache.
707 @item _SC_LEVEL1_DCACHE_LINESIZE
708 @standards{GNU, unistd.h}
709 Inquire about the line length of the Level 1 data cache.
711 On aarch64, the cache line size returned is the minimum data cache line size
712 observable by userspace. This is typically the same as the L1 dcache size but
713 on some cores it may not be so. However, it is specified in the architecture
714 that operations such as cache line invalidation are consistent with the size
715 reported with this variable.
717 @item _SC_LEVEL2_CACHE_SIZE
718 @standards{GNU, unistd.h}
719 Inquire about the size of the Level 2 cache.
721 @item _SC_LEVEL2_CACHE_ASSOC
722 @standards{GNU, unistd.h}
723 Inquire about the associativity of the Level 2 cache.
725 @item _SC_LEVEL2_CACHE_LINESIZE
726 @standards{GNU, unistd.h}
727 Inquire about the line length of the Level 2 cache.
729 @item _SC_LEVEL3_CACHE_SIZE
730 @standards{GNU, unistd.h}
731 Inquire about the size of the Level 3 cache.
733 @item _SC_LEVEL3_CACHE_ASSOC
734 @standards{GNU, unistd.h}
735 Inquire about the associativity of the Level 3 cache.
737 @item _SC_LEVEL3_CACHE_LINESIZE
738 @standards{GNU, unistd.h}
739 Inquire about the line length of the Level 3 cache.
741 @item _SC_LEVEL4_CACHE_SIZE
742 @standards{GNU, unistd.h}
743 Inquire about the size of the Level 4 cache.
745 @item _SC_LEVEL4_CACHE_ASSOC
746 @standards{GNU, unistd.h}
747 Inquire about the associativity of the Level 4 cache.
749 @item _SC_LEVEL4_CACHE_LINESIZE
750 @standards{GNU, unistd.h}
751 Inquire about the line length of the Level 4 cache.
754 @item _SC_XOPEN_VERSION
755 @standards{X/Open, unistd.h}
756 Inquire about the parameter corresponding to @code{_XOPEN_VERSION}.
758 @item _SC_XOPEN_XCU_VERSION
759 @standards{X/Open, unistd.h}
760 Inquire about the parameter corresponding to @code{_XOPEN_XCU_VERSION}.
763 @standards{X/Open, unistd.h}
764 Inquire about the parameter corresponding to @code{_XOPEN_UNIX}.
766 @item _SC_XOPEN_REALTIME
767 @standards{X/Open, unistd.h}
768 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME}.
770 @item _SC_XOPEN_REALTIME_THREADS
771 @standards{X/Open, unistd.h}
772 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME_THREADS}.
774 @item _SC_XOPEN_LEGACY
775 @standards{X/Open, unistd.h}
776 Inquire about the parameter corresponding to @code{_XOPEN_LEGACY}.
778 @item _SC_XOPEN_CRYPT
779 @standards{X/Open, unistd.h}
780 Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
781 @Theglibc no longer implements the @code{_XOPEN_CRYPT} extensions,
782 so @samp{sysconf (_SC_XOPEN_CRYPT)} always returns @code{-1}.
784 @item _SC_XOPEN_ENH_I18N
785 @standards{X/Open, unistd.h}
786 Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
789 @standards{X/Open, unistd.h}
790 Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
793 @standards{X/Open, unistd.h}
794 Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
797 @standards{X/Open, unistd.h}
798 Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
801 @standards{X/Open, unistd.h}
802 Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
805 @standards{X/Open, unistd.h}
806 Inquire about the number of bits in a variable of type @code{char}.
809 @standards{X/Open, unistd.h}
810 Inquire about the maximum value which can be stored in a variable of type
814 @standards{X/Open, unistd.h}
815 Inquire about the minimum value which can be stored in a variable of type
819 @standards{X/Open, unistd.h}
820 Inquire about the maximum value which can be stored in a variable of type
824 @standards{X/Open, unistd.h}
825 Inquire about the minimum value which can be stored in a variable of type
829 @standards{X/Open, unistd.h}
830 Inquire about the number of bits in a variable of type @code{long int}.
833 @standards{X/Open, unistd.h}
834 Inquire about the number of bits in a variable of a register word.
837 @standards{X/Open, unistd.h}
838 Inquire about the maximum length of a multi-byte representation of a wide
842 @standards{X/Open, unistd.h}
843 Inquire about the value used to internally represent the zero priority level for
844 the process execution.
847 @standards{X/Open, unistd.h}
848 Inquire about the maximum value which can be stored in a variable of type
852 @standards{X/Open, unistd.h}
853 Inquire about the maximum value which can be stored in a variable of type
857 @standards{X/Open, unistd.h}
858 Inquire about the minimum value which can be stored in a variable of type
862 @standards{X/Open, unistd.h}
863 Inquire about the maximum value which can be stored in a variable of type
867 @standards{X/Open, unistd.h}
868 Inquire about the minimum value which can be stored in a variable of type
872 @standards{X/Open, unistd.h}
873 Inquire about the maximum value which can be stored in a variable of type
874 @code{unsigned char}.
877 @standards{X/Open, unistd.h}
878 Inquire about the maximum value which can be stored in a variable of type
882 @standards{X/Open, unistd.h}
883 Inquire about the maximum value which can be stored in a variable of type
884 @code{unsigned long int}.
887 @standards{X/Open, unistd.h}
888 Inquire about the maximum value which can be stored in a variable of type
889 @code{unsigned short int}.
892 @standards{X/Open, unistd.h}
893 Inquire about the parameter corresponding to @code{NL_ARGMAX}.
896 @standards{X/Open, unistd.h}
897 Inquire about the parameter corresponding to @code{NL_LANGMAX}.
900 @standards{X/Open, unistd.h}
901 Inquire about the parameter corresponding to @code{NL_MSGMAX}.
904 @standards{X/Open, unistd.h}
905 Inquire about the parameter corresponding to @code{NL_NMAX}.
908 @standards{X/Open, unistd.h}
909 Inquire about the parameter corresponding to @code{NL_SETMAX}.
912 @standards{X/Open, unistd.h}
913 Inquire about the parameter corresponding to @code{NL_TEXTMAX}.
916 @node Examples of Sysconf
917 @subsection Examples of @code{sysconf}
919 We recommend that you first test for a macro definition for the
920 parameter you are interested in, and call @code{sysconf} only if the
921 macro is not defined. For example, here is how to test whether job
922 control is supported:
927 have_job_control (void)
929 #ifdef _POSIX_JOB_CONTROL
932 int value = sysconf (_SC_JOB_CONTROL);
934 /* @r{If the system is that badly wedged,}
935 @r{there's no use trying to go on.} */
936 fatal (strerror (errno));
943 Here is how to get the value of a numeric limit:
952 int value = sysconf (_SC_CHILD_MAX);
954 fatal (strerror (errno));
961 @section Minimum Values for General Capacity Limits
963 Here are the names for the POSIX minimum upper bounds for the system
964 limit parameters. The significance of these values is that you can
965 safely push to these limits without checking whether the particular
966 system you are using can go that far.
969 @item _POSIX_AIO_LISTIO_MAX
970 @standards{POSIX.1, limits.h}
971 The most restrictive limit permitted by POSIX for the maximum number of
972 I/O operations that can be specified in a list I/O call. The value of
973 this constant is @code{2}; thus you can add up to two new entries
974 of the list of outstanding operations.
977 @standards{POSIX.1, limits.h}
978 The most restrictive limit permitted by POSIX for the maximum number of
979 outstanding asynchronous I/O operations. The value of this constant is
980 @code{1}. So you cannot expect that you can issue more than one
981 operation and immediately continue with the normal work, receiving the
982 notifications asynchronously.
985 @standards{POSIX.1, limits.h}
986 The value of this macro is the most restrictive limit permitted by POSIX
987 for the maximum combined length of the @var{argv} and @var{environ}
988 arguments that can be passed to the @code{exec} functions.
989 Its value is @code{4096}.
991 @item _POSIX_CHILD_MAX
992 @standards{POSIX.1, limits.h}
993 The value of this macro is the most restrictive limit permitted by POSIX
994 for the maximum number of simultaneous processes per real user ID. Its
997 @item _POSIX_NGROUPS_MAX
998 @standards{POSIX.1, limits.h}
999 The value of this macro is the most restrictive limit permitted by POSIX
1000 for the maximum number of supplementary group IDs per process. Its
1003 @item _POSIX_OPEN_MAX
1004 @standards{POSIX.1, limits.h}
1005 The value of this macro is the most restrictive limit permitted by POSIX
1006 for the maximum number of files that a single process can have open
1007 simultaneously. Its value is @code{16}.
1009 @item _POSIX_SSIZE_MAX
1010 @standards{POSIX.1, limits.h}
1011 The value of this macro is the most restrictive limit permitted by POSIX
1012 for the maximum value that can be stored in an object of type
1013 @code{ssize_t}. Its value is @code{32767}.
1015 @item _POSIX_STREAM_MAX
1016 @standards{POSIX.1, limits.h}
1017 The value of this macro is the most restrictive limit permitted by POSIX
1018 for the maximum number of streams that a single process can have open
1019 simultaneously. Its value is @code{8}.
1021 @item _POSIX_TZNAME_MAX
1022 @standards{POSIX.1, limits.h}
1023 The value of this macro is the most restrictive limit permitted by POSIX
1024 for the maximum length of a time zone name. Its value is @code{3}.
1026 @item _POSIX2_RE_DUP_MAX
1027 @standards{POSIX.2, limits.h}
1028 The value of this macro is the most restrictive limit permitted by POSIX
1029 for the numbers used in the @samp{\@{@var{min},@var{max}\@}} construct
1030 in a regular expression. Its value is @code{255}.
1033 @node Limits for Files
1034 @section Limits on File System Capacity
1036 The POSIX.1 standard specifies a number of parameters that describe the
1037 limitations of the file system. It's possible for the system to have a
1038 fixed, uniform limit for a parameter, but this isn't the usual case. On
1039 most systems, it's possible for different file systems (and, for some
1040 parameters, even different files) to have different maximum limits. For
1041 example, this is very likely if you use NFS to mount some of the file
1042 systems from other machines.
1045 Each of the following macros is defined in @file{limits.h} only if the
1046 system has a fixed, uniform limit for the parameter in question. If the
1047 system allows different file systems or files to have different limits,
1048 then the macro is undefined; use @code{pathconf} or @code{fpathconf} to
1049 find out the limit that applies to a particular file. @xref{Pathconf}.
1051 Each parameter also has another macro, with a name starting with
1052 @samp{_POSIX}, which gives the lowest value that the limit is allowed to
1053 have on @emph{any} POSIX system. @xref{File Minimums}.
1055 @cindex limits, link count of files
1056 @deftypevr Macro int LINK_MAX
1057 @standards{POSIX.1, limits.h (optional)}
1058 The uniform system limit (if any) for the number of names for a given
1059 file. @xref{Hard Links}.
1062 @cindex limits, terminal input queue
1063 @deftypevr Macro int MAX_CANON
1064 @standards{POSIX.1, limits.h}
1065 The uniform system limit (if any) for the amount of text in a line of
1066 input when input editing is enabled. @xref{Canonical or Not}.
1069 @deftypevr Macro int MAX_INPUT
1070 @standards{POSIX.1, limits.h}
1071 The uniform system limit (if any) for the total number of characters
1072 typed ahead as input. @xref{I/O Queues}.
1075 @cindex limits, file name length
1076 @deftypevr Macro int NAME_MAX
1077 @standards{POSIX.1, limits.h}
1078 The uniform system limit (if any) for the length of a file name component, not
1079 including the terminating null character.
1081 @strong{Portability Note:} On some systems, @theglibc{} defines
1082 @code{NAME_MAX}, but does not actually enforce this limit.
1085 @deftypevr Macro int PATH_MAX
1086 @standards{POSIX.1, limits.h}
1087 The uniform system limit (if any) for the length of an entire file name (that
1088 is, the argument given to system calls such as @code{open}), including the
1089 terminating null character.
1091 @strong{Portability Note:} @Theglibc{} does not enforce this limit
1092 even if @code{PATH_MAX} is defined.
1095 @cindex limits, pipe buffer size
1096 @deftypevr Macro int PIPE_BUF
1097 @standards{POSIX.1, limits.h}
1098 The uniform system limit (if any) for the number of bytes that can be
1099 written atomically to a pipe. If multiple processes are writing to the
1100 same pipe simultaneously, output from different processes might be
1101 interleaved in chunks of this size. @xref{Pipes and FIFOs}.
1104 These are alternative macro names for some of the same information.
1106 @deftypevr Macro int MAXNAMLEN
1107 @standards{BSD, dirent.h}
1108 This is the BSD name for @code{NAME_MAX}. It is defined in
1112 @deftypevr Macro int FILENAME_MAX
1113 @standards{ISO, stdio.h}
1114 The value of this macro is an integer constant expression that
1115 represents the maximum length of a file name string. It is defined in
1118 Unlike @code{PATH_MAX}, this macro is defined even if there is no actual
1119 limit imposed. In such a case, its value is typically a very large
1120 number. @strong{This is always the case on @gnuhurdsystems{}.}
1122 @strong{Usage Note:} Don't use @code{FILENAME_MAX} as the size of an
1123 array in which to store a file name! You can't possibly make an array
1124 that big! Use dynamic allocation (@pxref{Memory Allocation}) instead.
1127 @node Options for Files
1128 @section Optional Features in File Support
1130 POSIX defines certain system-specific options in the system calls for
1131 operating on files. Some systems support these options and others do
1132 not. Since these options are provided in the kernel, not in the
1133 library, simply using @theglibc{} does not guarantee that any of these
1134 features is supported; it depends on the system you are using. They can
1135 also vary between file systems on a single machine.
1138 This section describes the macros you can test to determine whether a
1139 particular option is supported on your machine. If a given macro is
1140 defined in @file{unistd.h}, then its value says whether the
1141 corresponding feature is supported. (A value of @code{-1} indicates no;
1142 any other value indicates yes.) If the macro is undefined, it means
1143 particular files may or may not support the feature.
1145 Since all the machines that support @theglibc{} also support NFS,
1146 one can never make a general statement about whether all file systems
1147 support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC}
1148 features. So these names are never defined as macros in @theglibc{}.
1150 @deftypevr Macro int _POSIX_CHOWN_RESTRICTED
1151 @standards{POSIX.1, unistd.h}
1152 If this option is in effect, the @code{chown} function is restricted so
1153 that the only changes permitted to nonprivileged processes is to change
1154 the group owner of a file to either be the effective group ID of the
1155 process, or one of its supplementary group IDs. @xref{File Owner}.
1158 @deftypevr Macro int _POSIX_NO_TRUNC
1159 @standards{POSIX.1, unistd.h}
1160 If this option is in effect, file name components longer than
1161 @code{NAME_MAX} generate an @code{ENAMETOOLONG} error. Otherwise, file
1162 name components that are too long are silently truncated.
1165 @deftypevr Macro {unsigned char} _POSIX_VDISABLE
1166 @standards{POSIX.1, unistd.h}
1167 This option is only meaningful for files that are terminal devices.
1168 If it is enabled, then handling for special control characters can
1169 be disabled individually. @xref{Special Characters}.
1173 If one of these macros is undefined, that means that the option might be
1174 in effect for some files and not for others. To inquire about a
1175 particular file, call @code{pathconf} or @code{fpathconf}.
1179 @section Minimum Values for File System Limits
1181 Here are the names for the POSIX minimum upper bounds for some of the
1182 above parameters. The significance of these values is that you can
1183 safely push to these limits without checking whether the particular
1184 system you are using can go that far. In most cases @gnusystems{} do not
1185 have these strict limitations. The actual limit should be requested if
1189 @item _POSIX_LINK_MAX
1190 @standards{POSIX.1, limits.h}
1191 The most restrictive limit permitted by POSIX for the maximum value of a
1192 file's link count. The value of this constant is @code{8}; thus, you
1193 can always make up to eight names for a file without running into a
1196 @item _POSIX_MAX_CANON
1197 @standards{POSIX.1, limits.h}
1198 The most restrictive limit permitted by POSIX for the maximum number of
1199 bytes in a canonical input line from a terminal device. The value of
1200 this constant is @code{255}.
1202 @item _POSIX_MAX_INPUT
1203 @standards{POSIX.1, limits.h}
1204 The most restrictive limit permitted by POSIX for the maximum number of
1205 bytes in a terminal device input queue (or typeahead buffer).
1206 @xref{Input Modes}. The value of this constant is @code{255}.
1208 @item _POSIX_NAME_MAX
1209 @standards{POSIX.1, limits.h}
1210 The most restrictive limit permitted by POSIX for the maximum number of
1211 bytes in a file name component. The value of this constant is
1214 @item _POSIX_PATH_MAX
1215 @standards{POSIX.1, limits.h}
1216 The most restrictive limit permitted by POSIX for the maximum number of
1217 bytes in a file name. The value of this constant is @code{256}.
1219 @item _POSIX_PIPE_BUF
1220 @standards{POSIX.1, limits.h}
1221 The most restrictive limit permitted by POSIX for the maximum number of
1222 bytes that can be written atomically to a pipe. The value of this
1223 constant is @code{512}.
1226 @standards{POSIX.1, limits.h}
1227 Maximum number of bytes in a symbolic link.
1229 @item POSIX_REC_INCR_XFER_SIZE
1230 @standards{POSIX.1, limits.h}
1231 Recommended increment for file transfer sizes between the
1232 @code{POSIX_REC_MIN_XFER_SIZE} and @code{POSIX_REC_MAX_XFER_SIZE}
1235 @item POSIX_REC_MAX_XFER_SIZE
1236 @standards{POSIX.1, limits.h}
1237 Maximum recommended file transfer size.
1239 @item POSIX_REC_MIN_XFER_SIZE
1240 @standards{POSIX.1, limits.h}
1241 Minimum recommended file transfer size.
1243 @item POSIX_REC_XFER_ALIGN
1244 @standards{POSIX.1, limits.h}
1245 Recommended file transfer buffer alignment.
1249 @section Using @code{pathconf}
1251 When your machine allows different files to have different values for a
1252 file system parameter, you can use the functions in this section to find
1253 out the value that applies to any particular file.
1255 These functions and the associated constants for the @var{parameter}
1256 argument are declared in the header file @file{unistd.h}.
1258 @deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})
1259 @standards{POSIX.1, unistd.h}
1260 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1261 @c When __statfs_link_max finds an ext* filesystem, it may read
1262 @c /proc/mounts or similar as a mntent stream.
1263 @c __statfs_chown_restricted may read from
1264 @c /proc/sys/fs/xfs/restrict_chown as a file descriptor.
1265 This function is used to inquire about the limits that apply to
1266 the file named @var{filename}.
1268 The @var{parameter} argument should be one of the @samp{_PC_} constants
1271 The normal return value from @code{pathconf} is the value you requested.
1272 A value of @code{-1} is returned both if the implementation does not
1273 impose a limit, and in case of an error. In the former case,
1274 @code{errno} is not set, while in the latter case, @code{errno} is set
1275 to indicate the cause of the problem. So the only way to use this
1276 function robustly is to store @code{0} into @code{errno} just before
1279 Besides the usual file name errors (@pxref{File Name Errors}),
1280 the following error condition is defined for this function:
1284 The value of @var{parameter} is invalid, or the implementation doesn't
1285 support the @var{parameter} for the specific file.
1289 @deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})
1290 @standards{POSIX.1, unistd.h}
1291 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1292 @c Same caveats as pathconf.
1293 This is just like @code{pathconf} except that an open file descriptor
1294 is used to specify the file for which information is requested, instead
1297 The following @code{errno} error conditions are defined for this function:
1301 The @var{filedes} argument is not a valid file descriptor.
1304 The value of @var{parameter} is invalid, or the implementation doesn't
1305 support the @var{parameter} for the specific file.
1309 Here are the symbolic constants that you can use as the @var{parameter}
1310 argument to @code{pathconf} and @code{fpathconf}. The values are all
1315 @standards{POSIX.1, unistd.h}
1316 Inquire about the value of @code{LINK_MAX}.
1319 @standards{POSIX.1, unistd.h}
1320 Inquire about the value of @code{MAX_CANON}.
1323 @standards{POSIX.1, unistd.h}
1324 Inquire about the value of @code{MAX_INPUT}.
1327 @standards{POSIX.1, unistd.h}
1328 Inquire about the value of @code{NAME_MAX}.
1331 @standards{POSIX.1, unistd.h}
1332 Inquire about the value of @code{PATH_MAX}.
1335 @standards{POSIX.1, unistd.h}
1336 Inquire about the value of @code{PIPE_BUF}.
1338 @item _PC_CHOWN_RESTRICTED
1339 @standards{POSIX.1, unistd.h}
1340 Inquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.
1343 @standards{POSIX.1, unistd.h}
1344 Inquire about the value of @code{_POSIX_NO_TRUNC}.
1347 @standards{POSIX.1, unistd.h}
1348 Inquire about the value of @code{_POSIX_VDISABLE}.
1351 @standards{POSIX.1, unistd.h}
1352 Inquire about the value of @code{_POSIX_SYNC_IO}.
1355 @standards{POSIX.1, unistd.h}
1356 Inquire about the value of @code{_POSIX_ASYNC_IO}.
1359 @standards{POSIX.1, unistd.h}
1360 Inquire about the value of @code{_POSIX_PRIO_IO}.
1362 @item _PC_FILESIZEBITS
1363 @standards{LFS, unistd.h}
1364 Inquire about the availability of large files on the filesystem.
1366 @item _PC_REC_INCR_XFER_SIZE
1367 @standards{POSIX.1, unistd.h}
1368 Inquire about the value of @code{POSIX_REC_INCR_XFER_SIZE}.
1370 @item _PC_REC_MAX_XFER_SIZE
1371 @standards{POSIX.1, unistd.h}
1372 Inquire about the value of @code{POSIX_REC_MAX_XFER_SIZE}.
1374 @item _PC_REC_MIN_XFER_SIZE
1375 @standards{POSIX.1, unistd.h}
1376 Inquire about the value of @code{POSIX_REC_MIN_XFER_SIZE}.
1378 @item _PC_REC_XFER_ALIGN
1379 @standards{POSIX.1, unistd.h}
1380 Inquire about the value of @code{POSIX_REC_XFER_ALIGN}.
1383 @strong{Portability Note:} On some systems, @theglibc{} does not
1384 enforce @code{_PC_NAME_MAX} or @code{_PC_PATH_MAX} limits.
1386 @node Utility Limits
1387 @section Utility Program Capacity Limits
1389 The POSIX.2 standard specifies certain system limits that you can access
1390 through @code{sysconf} that apply to utility behavior rather than the
1391 behavior of the library or the operating system.
1393 @Theglibc{} defines macros for these limits, and @code{sysconf}
1394 returns values for them if you ask; but these values convey no
1395 meaningful information. They are simply the smallest values that
1398 @deftypevr Macro int BC_BASE_MAX
1399 @standards{POSIX.2, limits.h}
1400 The largest value of @code{obase} that the @code{bc} utility is
1401 guaranteed to support.
1404 @deftypevr Macro int BC_DIM_MAX
1405 @standards{POSIX.2, limits.h}
1406 The largest number of elements in one array that the @code{bc} utility
1407 is guaranteed to support.
1410 @deftypevr Macro int BC_SCALE_MAX
1411 @standards{POSIX.2, limits.h}
1412 The largest value of @code{scale} that the @code{bc} utility is
1413 guaranteed to support.
1416 @deftypevr Macro int BC_STRING_MAX
1417 @standards{POSIX.2, limits.h}
1418 The largest number of characters in one string constant that the
1419 @code{bc} utility is guaranteed to support.
1422 @deftypevr Macro int COLL_WEIGHTS_MAX
1423 @standards{POSIX.2, limits.h}
1424 The largest number of weights that can necessarily be used in defining
1425 the collating sequence for a locale.
1428 @deftypevr Macro int EXPR_NEST_MAX
1429 @standards{POSIX.2, limits.h}
1430 The maximum number of expressions that can be nested within parentheses
1431 by the @code{expr} utility.
1434 @deftypevr Macro int LINE_MAX
1435 @standards{POSIX.2, limits.h}
1436 The largest text line that the text-oriented POSIX.2 utilities can
1437 support. (If you are using the GNU versions of these utilities, then
1438 there is no actual limit except that imposed by the available virtual
1439 memory, but there is no way that the library can tell you this.)
1442 @deftypevr Macro int EQUIV_CLASS_MAX
1443 @standards{POSIX.2, limits.h}
1444 The maximum number of weights that can be assigned to an entry of the
1445 @code{LC_COLLATE} category @samp{order} keyword in a locale definition.
1446 @Theglibc{} does not presently support locale definitions.
1449 @node Utility Minimums
1450 @section Minimum Values for Utility Limits
1453 @item _POSIX2_BC_BASE_MAX
1454 @standards{POSIX.2, limits.h}
1455 The most restrictive limit permitted by POSIX.2 for the maximum value of
1456 @code{obase} in the @code{bc} utility. Its value is @code{99}.
1458 @item _POSIX2_BC_DIM_MAX
1459 @standards{POSIX.2, limits.h}
1460 The most restrictive limit permitted by POSIX.2 for the maximum size of
1461 an array in the @code{bc} utility. Its value is @code{2048}.
1463 @item _POSIX2_BC_SCALE_MAX
1464 @standards{POSIX.2, limits.h}
1465 The most restrictive limit permitted by POSIX.2 for the maximum value of
1466 @code{scale} in the @code{bc} utility. Its value is @code{99}.
1468 @item _POSIX2_BC_STRING_MAX
1469 @standards{POSIX.2, limits.h}
1470 The most restrictive limit permitted by POSIX.2 for the maximum size of
1471 a string constant in the @code{bc} utility. Its value is @code{1000}.
1473 @item _POSIX2_COLL_WEIGHTS_MAX
1474 @standards{POSIX.2, limits.h}
1475 The most restrictive limit permitted by POSIX.2 for the maximum number
1476 of weights that can necessarily be used in defining the collating
1477 sequence for a locale. Its value is @code{2}.
1479 @item _POSIX2_EXPR_NEST_MAX
1480 @standards{POSIX.2, limits.h}
1481 The most restrictive limit permitted by POSIX.2 for the maximum number
1482 of expressions nested within parenthesis when using the @code{expr} utility.
1483 Its value is @code{32}.
1485 @item _POSIX2_LINE_MAX
1486 @standards{POSIX.2, limits.h}
1487 The most restrictive limit permitted by POSIX.2 for the maximum size of
1488 a text line that the text utilities can handle. Its value is
1491 @item _POSIX2_EQUIV_CLASS_MAX
1492 @standards{POSIX.2, limits.h}
1493 The most restrictive limit permitted by POSIX.2 for the maximum number
1494 of weights that can be assigned to an entry of the @code{LC_COLLATE}
1495 category @samp{order} keyword in a locale definition. Its value is
1496 @code{2}. @Theglibc{} does not presently support locale
1500 @node String Parameters
1501 @section String-Valued Parameters
1503 POSIX.2 defines a way to get string-valued parameters from the operating
1504 system with the function @code{confstr}:
1506 @deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})
1507 @standards{POSIX.2, unistd.h}
1508 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
1509 This function reads the value of a string-valued system parameter,
1510 storing the string into @var{len} bytes of memory space starting at
1511 @var{buf}. The @var{parameter} argument should be one of the
1512 @samp{_CS_} symbols listed below.
1514 The normal return value from @code{confstr} is the length of the string
1515 value that you asked for. If you supply a null pointer for @var{buf},
1516 then @code{confstr} does not try to store the string; it just returns
1517 its length. A value of @code{0} indicates an error.
1519 If the string you asked for is too long for the buffer (that is, longer
1520 than @code{@var{len} - 1}), then @code{confstr} stores just that much
1521 (leaving room for the terminating null character). You can tell that
1522 this has happened because @code{confstr} returns a value greater than or
1525 The following @code{errno} error conditions are defined for this function:
1529 The value of the @var{parameter} is invalid.
1533 Currently there is just one parameter you can read with @code{confstr}:
1537 @standards{POSIX.2, unistd.h}
1538 This parameter's value is the recommended default path for searching for
1539 executable files. This is the path that a user has by default just
1542 @item _CS_LFS_CFLAGS
1543 @standards{Unix98, unistd.h}
1544 The returned string specifies which additional flags must be given to
1545 the C compiler if a source is compiled using the
1546 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1548 @item _CS_LFS_LDFLAGS
1549 @standards{Unix98, unistd.h}
1550 The returned string specifies which additional flags must be given to
1551 the linker if a source is compiled using the
1552 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1555 @standards{Unix98, unistd.h}
1556 The returned string specifies which additional libraries must be linked
1557 to the application if a source is compiled using the
1558 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1560 @item _CS_LFS_LINTFLAGS
1561 @standards{Unix98, unistd.h}
1562 The returned string specifies which additional flags must be given to
1563 the lint tool if a source is compiled using the
1564 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1566 @item _CS_LFS64_CFLAGS
1567 @standards{Unix98, unistd.h}
1568 The returned string specifies which additional flags must be given to
1569 the C compiler if a source is compiled using the
1570 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1572 @item _CS_LFS64_LDFLAGS
1573 @standards{Unix98, unistd.h}
1574 The returned string specifies which additional flags must be given to
1575 the linker if a source is compiled using the
1576 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1578 @item _CS_LFS64_LIBS
1579 @standards{Unix98, unistd.h}
1580 The returned string specifies which additional libraries must be linked
1581 to the application if a source is compiled using the
1582 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1584 @item _CS_LFS64_LINTFLAGS
1585 @standards{Unix98, unistd.h}
1586 The returned string specifies which additional flags must be given to
1587 the lint tool if a source is compiled using the
1588 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1591 The way to use @code{confstr} without any arbitrary limit on string size
1592 is to call it twice: first call it to get the length, allocate the
1593 buffer accordingly, and then call @code{confstr} again to fill the
1599 get_default_path (void)
1601 size_t len = confstr (_CS_PATH, NULL, 0);
1602 char *buffer = (char *) xmalloc (len);
1604 if (confstr (_CS_PATH, buf, len + 1) == 0)