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_XOPEN_VERSION
682 @standards{X/Open, unistd.h}
683 Inquire about the parameter corresponding to @code{_XOPEN_VERSION}.
685 @item _SC_XOPEN_XCU_VERSION
686 @standards{X/Open, unistd.h}
687 Inquire about the parameter corresponding to @code{_XOPEN_XCU_VERSION}.
690 @standards{X/Open, unistd.h}
691 Inquire about the parameter corresponding to @code{_XOPEN_UNIX}.
693 @item _SC_XOPEN_REALTIME
694 @standards{X/Open, unistd.h}
695 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME}.
697 @item _SC_XOPEN_REALTIME_THREADS
698 @standards{X/Open, unistd.h}
699 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME_THREADS}.
701 @item _SC_XOPEN_LEGACY
702 @standards{X/Open, unistd.h}
703 Inquire about the parameter corresponding to @code{_XOPEN_LEGACY}.
705 @item _SC_XOPEN_CRYPT
706 @standards{X/Open, unistd.h}
707 Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
709 @item _SC_XOPEN_ENH_I18N
710 @standards{X/Open, unistd.h}
711 Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
714 @standards{X/Open, unistd.h}
715 Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
718 @standards{X/Open, unistd.h}
719 Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
722 @standards{X/Open, unistd.h}
723 Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
726 @standards{X/Open, unistd.h}
727 Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
730 @standards{X/Open, unistd.h}
731 Inquire about the number of bits in a variable of type @code{char}.
734 @standards{X/Open, unistd.h}
735 Inquire about the maximum value which can be stored in a variable of type
739 @standards{X/Open, unistd.h}
740 Inquire about the minimum value which can be stored in a variable of type
744 @standards{X/Open, unistd.h}
745 Inquire about the maximum value which can be stored in a variable of type
749 @standards{X/Open, unistd.h}
750 Inquire about the minimum value which can be stored in a variable of type
754 @standards{X/Open, unistd.h}
755 Inquire about the number of bits in a variable of type @code{long int}.
758 @standards{X/Open, unistd.h}
759 Inquire about the number of bits in a variable of a register word.
762 @standards{X/Open, unistd.h}
763 Inquire about the maximum length of a multi-byte representation of a wide
767 @standards{X/Open, unistd.h}
768 Inquire about the value used to internally represent the zero priority level for
769 the process execution.
772 @standards{X/Open, unistd.h}
773 Inquire about the maximum value which can be stored in a variable of type
777 @standards{X/Open, unistd.h}
778 Inquire about the maximum value which can be stored in a variable of type
782 @standards{X/Open, unistd.h}
783 Inquire about the minimum value which can be stored in a variable of type
787 @standards{X/Open, unistd.h}
788 Inquire about the maximum value which can be stored in a variable of type
792 @standards{X/Open, unistd.h}
793 Inquire about the minimum value which can be stored in a variable of type
797 @standards{X/Open, unistd.h}
798 Inquire about the maximum value which can be stored in a variable of type
799 @code{unsigned char}.
802 @standards{X/Open, unistd.h}
803 Inquire about the maximum value which can be stored in a variable of type
807 @standards{X/Open, unistd.h}
808 Inquire about the maximum value which can be stored in a variable of type
809 @code{unsigned long int}.
812 @standards{X/Open, unistd.h}
813 Inquire about the maximum value which can be stored in a variable of type
814 @code{unsigned short int}.
817 @standards{X/Open, unistd.h}
818 Inquire about the parameter corresponding to @code{NL_ARGMAX}.
821 @standards{X/Open, unistd.h}
822 Inquire about the parameter corresponding to @code{NL_LANGMAX}.
825 @standards{X/Open, unistd.h}
826 Inquire about the parameter corresponding to @code{NL_MSGMAX}.
829 @standards{X/Open, unistd.h}
830 Inquire about the parameter corresponding to @code{NL_NMAX}.
833 @standards{X/Open, unistd.h}
834 Inquire about the parameter corresponding to @code{NL_SETMAX}.
837 @standards{X/Open, unistd.h}
838 Inquire about the parameter corresponding to @code{NL_TEXTMAX}.
841 @node Examples of Sysconf
842 @subsection Examples of @code{sysconf}
844 We recommend that you first test for a macro definition for the
845 parameter you are interested in, and call @code{sysconf} only if the
846 macro is not defined. For example, here is how to test whether job
847 control is supported:
852 have_job_control (void)
854 #ifdef _POSIX_JOB_CONTROL
857 int value = sysconf (_SC_JOB_CONTROL);
859 /* @r{If the system is that badly wedged,}
860 @r{there's no use trying to go on.} */
861 fatal (strerror (errno));
868 Here is how to get the value of a numeric limit:
877 int value = sysconf (_SC_CHILD_MAX);
879 fatal (strerror (errno));
886 @section Minimum Values for General Capacity Limits
888 Here are the names for the POSIX minimum upper bounds for the system
889 limit parameters. The significance of these values is that you can
890 safely push to these limits without checking whether the particular
891 system you are using can go that far.
894 @item _POSIX_AIO_LISTIO_MAX
895 @standards{POSIX.1, limits.h}
896 The most restrictive limit permitted by POSIX for the maximum number of
897 I/O operations that can be specified in a list I/O call. The value of
898 this constant is @code{2}; thus you can add up to two new entries
899 of the list of outstanding operations.
902 @standards{POSIX.1, limits.h}
903 The most restrictive limit permitted by POSIX for the maximum number of
904 outstanding asynchronous I/O operations. The value of this constant is
905 @code{1}. So you cannot expect that you can issue more than one
906 operation and immediately continue with the normal work, receiving the
907 notifications asynchronously.
910 @standards{POSIX.1, limits.h}
911 The value of this macro is the most restrictive limit permitted by POSIX
912 for the maximum combined length of the @var{argv} and @var{environ}
913 arguments that can be passed to the @code{exec} functions.
914 Its value is @code{4096}.
916 @item _POSIX_CHILD_MAX
917 @standards{POSIX.1, limits.h}
918 The value of this macro is the most restrictive limit permitted by POSIX
919 for the maximum number of simultaneous processes per real user ID. Its
922 @item _POSIX_NGROUPS_MAX
923 @standards{POSIX.1, limits.h}
924 The value of this macro is the most restrictive limit permitted by POSIX
925 for the maximum number of supplementary group IDs per process. Its
928 @item _POSIX_OPEN_MAX
929 @standards{POSIX.1, limits.h}
930 The value of this macro is the most restrictive limit permitted by POSIX
931 for the maximum number of files that a single process can have open
932 simultaneously. Its value is @code{16}.
934 @item _POSIX_SSIZE_MAX
935 @standards{POSIX.1, limits.h}
936 The value of this macro is the most restrictive limit permitted by POSIX
937 for the maximum value that can be stored in an object of type
938 @code{ssize_t}. Its value is @code{32767}.
940 @item _POSIX_STREAM_MAX
941 @standards{POSIX.1, limits.h}
942 The value of this macro is the most restrictive limit permitted by POSIX
943 for the maximum number of streams that a single process can have open
944 simultaneously. Its value is @code{8}.
946 @item _POSIX_TZNAME_MAX
947 @standards{POSIX.1, limits.h}
948 The value of this macro is the most restrictive limit permitted by POSIX
949 for the maximum length of a time zone name. Its value is @code{3}.
951 @item _POSIX2_RE_DUP_MAX
952 @standards{POSIX.2, limits.h}
953 The value of this macro is the most restrictive limit permitted by POSIX
954 for the numbers used in the @samp{\@{@var{min},@var{max}\@}} construct
955 in a regular expression. Its value is @code{255}.
958 @node Limits for Files
959 @section Limits on File System Capacity
961 The POSIX.1 standard specifies a number of parameters that describe the
962 limitations of the file system. It's possible for the system to have a
963 fixed, uniform limit for a parameter, but this isn't the usual case. On
964 most systems, it's possible for different file systems (and, for some
965 parameters, even different files) to have different maximum limits. For
966 example, this is very likely if you use NFS to mount some of the file
967 systems from other machines.
970 Each of the following macros is defined in @file{limits.h} only if the
971 system has a fixed, uniform limit for the parameter in question. If the
972 system allows different file systems or files to have different limits,
973 then the macro is undefined; use @code{pathconf} or @code{fpathconf} to
974 find out the limit that applies to a particular file. @xref{Pathconf}.
976 Each parameter also has another macro, with a name starting with
977 @samp{_POSIX}, which gives the lowest value that the limit is allowed to
978 have on @emph{any} POSIX system. @xref{File Minimums}.
980 @cindex limits, link count of files
981 @deftypevr Macro int LINK_MAX
982 @standards{POSIX.1, limits.h (optional)}
983 The uniform system limit (if any) for the number of names for a given
984 file. @xref{Hard Links}.
987 @cindex limits, terminal input queue
988 @deftypevr Macro int MAX_CANON
989 @standards{POSIX.1, limits.h}
990 The uniform system limit (if any) for the amount of text in a line of
991 input when input editing is enabled. @xref{Canonical or Not}.
994 @deftypevr Macro int MAX_INPUT
995 @standards{POSIX.1, limits.h}
996 The uniform system limit (if any) for the total number of characters
997 typed ahead as input. @xref{I/O Queues}.
1000 @cindex limits, file name length
1001 @deftypevr Macro int NAME_MAX
1002 @standards{POSIX.1, limits.h}
1003 The uniform system limit (if any) for the length of a file name component, not
1004 including the terminating null character.
1006 @strong{Portability Note:} On some systems, @theglibc{} defines
1007 @code{NAME_MAX}, but does not actually enforce this limit.
1010 @deftypevr Macro int PATH_MAX
1011 @standards{POSIX.1, limits.h}
1012 The uniform system limit (if any) for the length of an entire file name (that
1013 is, the argument given to system calls such as @code{open}), including the
1014 terminating null character.
1016 @strong{Portability Note:} @Theglibc{} does not enforce this limit
1017 even if @code{PATH_MAX} is defined.
1020 @cindex limits, pipe buffer size
1021 @deftypevr Macro int PIPE_BUF
1022 @standards{POSIX.1, limits.h}
1023 The uniform system limit (if any) for the number of bytes that can be
1024 written atomically to a pipe. If multiple processes are writing to the
1025 same pipe simultaneously, output from different processes might be
1026 interleaved in chunks of this size. @xref{Pipes and FIFOs}.
1029 These are alternative macro names for some of the same information.
1031 @deftypevr Macro int MAXNAMLEN
1032 @standards{BSD, dirent.h}
1033 This is the BSD name for @code{NAME_MAX}. It is defined in
1037 @deftypevr Macro int FILENAME_MAX
1038 @standards{ISO, stdio.h}
1039 The value of this macro is an integer constant expression that
1040 represents the maximum length of a file name string. It is defined in
1043 Unlike @code{PATH_MAX}, this macro is defined even if there is no actual
1044 limit imposed. In such a case, its value is typically a very large
1045 number. @strong{This is always the case on @gnuhurdsystems{}.}
1047 @strong{Usage Note:} Don't use @code{FILENAME_MAX} as the size of an
1048 array in which to store a file name! You can't possibly make an array
1049 that big! Use dynamic allocation (@pxref{Memory Allocation}) instead.
1052 @node Options for Files
1053 @section Optional Features in File Support
1055 POSIX defines certain system-specific options in the system calls for
1056 operating on files. Some systems support these options and others do
1057 not. Since these options are provided in the kernel, not in the
1058 library, simply using @theglibc{} does not guarantee that any of these
1059 features is supported; it depends on the system you are using. They can
1060 also vary between file systems on a single machine.
1063 This section describes the macros you can test to determine whether a
1064 particular option is supported on your machine. If a given macro is
1065 defined in @file{unistd.h}, then its value says whether the
1066 corresponding feature is supported. (A value of @code{-1} indicates no;
1067 any other value indicates yes.) If the macro is undefined, it means
1068 particular files may or may not support the feature.
1070 Since all the machines that support @theglibc{} also support NFS,
1071 one can never make a general statement about whether all file systems
1072 support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC}
1073 features. So these names are never defined as macros in @theglibc{}.
1075 @deftypevr Macro int _POSIX_CHOWN_RESTRICTED
1076 @standards{POSIX.1, unistd.h}
1077 If this option is in effect, the @code{chown} function is restricted so
1078 that the only changes permitted to nonprivileged processes is to change
1079 the group owner of a file to either be the effective group ID of the
1080 process, or one of its supplementary group IDs. @xref{File Owner}.
1083 @deftypevr Macro int _POSIX_NO_TRUNC
1084 @standards{POSIX.1, unistd.h}
1085 If this option is in effect, file name components longer than
1086 @code{NAME_MAX} generate an @code{ENAMETOOLONG} error. Otherwise, file
1087 name components that are too long are silently truncated.
1090 @deftypevr Macro {unsigned char} _POSIX_VDISABLE
1091 @standards{POSIX.1, unistd.h}
1092 This option is only meaningful for files that are terminal devices.
1093 If it is enabled, then handling for special control characters can
1094 be disabled individually. @xref{Special Characters}.
1098 If one of these macros is undefined, that means that the option might be
1099 in effect for some files and not for others. To inquire about a
1100 particular file, call @code{pathconf} or @code{fpathconf}.
1104 @section Minimum Values for File System Limits
1106 Here are the names for the POSIX minimum upper bounds for some of the
1107 above parameters. The significance of these values is that you can
1108 safely push to these limits without checking whether the particular
1109 system you are using can go that far. In most cases @gnusystems{} do not
1110 have these strict limitations. The actual limit should be requested if
1114 @item _POSIX_LINK_MAX
1115 @standards{POSIX.1, limits.h}
1116 The most restrictive limit permitted by POSIX for the maximum value of a
1117 file's link count. The value of this constant is @code{8}; thus, you
1118 can always make up to eight names for a file without running into a
1121 @item _POSIX_MAX_CANON
1122 @standards{POSIX.1, limits.h}
1123 The most restrictive limit permitted by POSIX for the maximum number of
1124 bytes in a canonical input line from a terminal device. The value of
1125 this constant is @code{255}.
1127 @item _POSIX_MAX_INPUT
1128 @standards{POSIX.1, limits.h}
1129 The most restrictive limit permitted by POSIX for the maximum number of
1130 bytes in a terminal device input queue (or typeahead buffer).
1131 @xref{Input Modes}. The value of this constant is @code{255}.
1133 @item _POSIX_NAME_MAX
1134 @standards{POSIX.1, limits.h}
1135 The most restrictive limit permitted by POSIX for the maximum number of
1136 bytes in a file name component. The value of this constant is
1139 @item _POSIX_PATH_MAX
1140 @standards{POSIX.1, limits.h}
1141 The most restrictive limit permitted by POSIX for the maximum number of
1142 bytes in a file name. The value of this constant is @code{256}.
1144 @item _POSIX_PIPE_BUF
1145 @standards{POSIX.1, limits.h}
1146 The most restrictive limit permitted by POSIX for the maximum number of
1147 bytes that can be written atomically to a pipe. The value of this
1148 constant is @code{512}.
1151 @standards{POSIX.1, limits.h}
1152 Maximum number of bytes in a symbolic link.
1154 @item POSIX_REC_INCR_XFER_SIZE
1155 @standards{POSIX.1, limits.h}
1156 Recommended increment for file transfer sizes between the
1157 @code{POSIX_REC_MIN_XFER_SIZE} and @code{POSIX_REC_MAX_XFER_SIZE}
1160 @item POSIX_REC_MAX_XFER_SIZE
1161 @standards{POSIX.1, limits.h}
1162 Maximum recommended file transfer size.
1164 @item POSIX_REC_MIN_XFER_SIZE
1165 @standards{POSIX.1, limits.h}
1166 Minimum recommended file transfer size.
1168 @item POSIX_REC_XFER_ALIGN
1169 @standards{POSIX.1, limits.h}
1170 Recommended file transfer buffer alignment.
1174 @section Using @code{pathconf}
1176 When your machine allows different files to have different values for a
1177 file system parameter, you can use the functions in this section to find
1178 out the value that applies to any particular file.
1180 These functions and the associated constants for the @var{parameter}
1181 argument are declared in the header file @file{unistd.h}.
1183 @deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})
1184 @standards{POSIX.1, unistd.h}
1185 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1186 @c When __statfs_link_max finds an ext* filesystem, it may read
1187 @c /proc/mounts or similar as a mntent stream.
1188 @c __statfs_chown_restricted may read from
1189 @c /proc/sys/fs/xfs/restrict_chown as a file descriptor.
1190 This function is used to inquire about the limits that apply to
1191 the file named @var{filename}.
1193 The @var{parameter} argument should be one of the @samp{_PC_} constants
1196 The normal return value from @code{pathconf} is the value you requested.
1197 A value of @code{-1} is returned both if the implementation does not
1198 impose a limit, and in case of an error. In the former case,
1199 @code{errno} is not set, while in the latter case, @code{errno} is set
1200 to indicate the cause of the problem. So the only way to use this
1201 function robustly is to store @code{0} into @code{errno} just before
1204 Besides the usual file name errors (@pxref{File Name Errors}),
1205 the following error condition is defined for this function:
1209 The value of @var{parameter} is invalid, or the implementation doesn't
1210 support the @var{parameter} for the specific file.
1214 @deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})
1215 @standards{POSIX.1, unistd.h}
1216 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1217 @c Same caveats as pathconf.
1218 This is just like @code{pathconf} except that an open file descriptor
1219 is used to specify the file for which information is requested, instead
1222 The following @code{errno} error conditions are defined for this function:
1226 The @var{filedes} argument is not a valid file descriptor.
1229 The value of @var{parameter} is invalid, or the implementation doesn't
1230 support the @var{parameter} for the specific file.
1234 Here are the symbolic constants that you can use as the @var{parameter}
1235 argument to @code{pathconf} and @code{fpathconf}. The values are all
1240 @standards{POSIX.1, unistd.h}
1241 Inquire about the value of @code{LINK_MAX}.
1244 @standards{POSIX.1, unistd.h}
1245 Inquire about the value of @code{MAX_CANON}.
1248 @standards{POSIX.1, unistd.h}
1249 Inquire about the value of @code{MAX_INPUT}.
1252 @standards{POSIX.1, unistd.h}
1253 Inquire about the value of @code{NAME_MAX}.
1256 @standards{POSIX.1, unistd.h}
1257 Inquire about the value of @code{PATH_MAX}.
1260 @standards{POSIX.1, unistd.h}
1261 Inquire about the value of @code{PIPE_BUF}.
1263 @item _PC_CHOWN_RESTRICTED
1264 @standards{POSIX.1, unistd.h}
1265 Inquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.
1268 @standards{POSIX.1, unistd.h}
1269 Inquire about the value of @code{_POSIX_NO_TRUNC}.
1272 @standards{POSIX.1, unistd.h}
1273 Inquire about the value of @code{_POSIX_VDISABLE}.
1276 @standards{POSIX.1, unistd.h}
1277 Inquire about the value of @code{_POSIX_SYNC_IO}.
1280 @standards{POSIX.1, unistd.h}
1281 Inquire about the value of @code{_POSIX_ASYNC_IO}.
1284 @standards{POSIX.1, unistd.h}
1285 Inquire about the value of @code{_POSIX_PRIO_IO}.
1287 @item _PC_FILESIZEBITS
1288 @standards{LFS, unistd.h}
1289 Inquire about the availability of large files on the filesystem.
1291 @item _PC_REC_INCR_XFER_SIZE
1292 @standards{POSIX.1, unistd.h}
1293 Inquire about the value of @code{POSIX_REC_INCR_XFER_SIZE}.
1295 @item _PC_REC_MAX_XFER_SIZE
1296 @standards{POSIX.1, unistd.h}
1297 Inquire about the value of @code{POSIX_REC_MAX_XFER_SIZE}.
1299 @item _PC_REC_MIN_XFER_SIZE
1300 @standards{POSIX.1, unistd.h}
1301 Inquire about the value of @code{POSIX_REC_MIN_XFER_SIZE}.
1303 @item _PC_REC_XFER_ALIGN
1304 @standards{POSIX.1, unistd.h}
1305 Inquire about the value of @code{POSIX_REC_XFER_ALIGN}.
1308 @strong{Portability Note:} On some systems, @theglibc{} does not
1309 enforce @code{_PC_NAME_MAX} or @code{_PC_PATH_MAX} limits.
1311 @node Utility Limits
1312 @section Utility Program Capacity Limits
1314 The POSIX.2 standard specifies certain system limits that you can access
1315 through @code{sysconf} that apply to utility behavior rather than the
1316 behavior of the library or the operating system.
1318 @Theglibc{} defines macros for these limits, and @code{sysconf}
1319 returns values for them if you ask; but these values convey no
1320 meaningful information. They are simply the smallest values that
1323 @deftypevr Macro int BC_BASE_MAX
1324 @standards{POSIX.2, limits.h}
1325 The largest value of @code{obase} that the @code{bc} utility is
1326 guaranteed to support.
1329 @deftypevr Macro int BC_DIM_MAX
1330 @standards{POSIX.2, limits.h}
1331 The largest number of elements in one array that the @code{bc} utility
1332 is guaranteed to support.
1335 @deftypevr Macro int BC_SCALE_MAX
1336 @standards{POSIX.2, limits.h}
1337 The largest value of @code{scale} that the @code{bc} utility is
1338 guaranteed to support.
1341 @deftypevr Macro int BC_STRING_MAX
1342 @standards{POSIX.2, limits.h}
1343 The largest number of characters in one string constant that the
1344 @code{bc} utility is guaranteed to support.
1347 @deftypevr Macro int COLL_WEIGHTS_MAX
1348 @standards{POSIX.2, limits.h}
1349 The largest number of weights that can necessarily be used in defining
1350 the collating sequence for a locale.
1353 @deftypevr Macro int EXPR_NEST_MAX
1354 @standards{POSIX.2, limits.h}
1355 The maximum number of expressions that can be nested within parentheses
1356 by the @code{expr} utility.
1359 @deftypevr Macro int LINE_MAX
1360 @standards{POSIX.2, limits.h}
1361 The largest text line that the text-oriented POSIX.2 utilities can
1362 support. (If you are using the GNU versions of these utilities, then
1363 there is no actual limit except that imposed by the available virtual
1364 memory, but there is no way that the library can tell you this.)
1367 @deftypevr Macro int EQUIV_CLASS_MAX
1368 @standards{POSIX.2, limits.h}
1369 The maximum number of weights that can be assigned to an entry of the
1370 @code{LC_COLLATE} category @samp{order} keyword in a locale definition.
1371 @Theglibc{} does not presently support locale definitions.
1374 @node Utility Minimums
1375 @section Minimum Values for Utility Limits
1378 @item _POSIX2_BC_BASE_MAX
1379 @standards{POSIX.2, limits.h}
1380 The most restrictive limit permitted by POSIX.2 for the maximum value of
1381 @code{obase} in the @code{bc} utility. Its value is @code{99}.
1383 @item _POSIX2_BC_DIM_MAX
1384 @standards{POSIX.2, limits.h}
1385 The most restrictive limit permitted by POSIX.2 for the maximum size of
1386 an array in the @code{bc} utility. Its value is @code{2048}.
1388 @item _POSIX2_BC_SCALE_MAX
1389 @standards{POSIX.2, limits.h}
1390 The most restrictive limit permitted by POSIX.2 for the maximum value of
1391 @code{scale} in the @code{bc} utility. Its value is @code{99}.
1393 @item _POSIX2_BC_STRING_MAX
1394 @standards{POSIX.2, limits.h}
1395 The most restrictive limit permitted by POSIX.2 for the maximum size of
1396 a string constant in the @code{bc} utility. Its value is @code{1000}.
1398 @item _POSIX2_COLL_WEIGHTS_MAX
1399 @standards{POSIX.2, limits.h}
1400 The most restrictive limit permitted by POSIX.2 for the maximum number
1401 of weights that can necessarily be used in defining the collating
1402 sequence for a locale. Its value is @code{2}.
1404 @item _POSIX2_EXPR_NEST_MAX
1405 @standards{POSIX.2, limits.h}
1406 The most restrictive limit permitted by POSIX.2 for the maximum number
1407 of expressions nested within parenthesis when using the @code{expr} utility.
1408 Its value is @code{32}.
1410 @item _POSIX2_LINE_MAX
1411 @standards{POSIX.2, limits.h}
1412 The most restrictive limit permitted by POSIX.2 for the maximum size of
1413 a text line that the text utilities can handle. Its value is
1416 @item _POSIX2_EQUIV_CLASS_MAX
1417 @standards{POSIX.2, limits.h}
1418 The most restrictive limit permitted by POSIX.2 for the maximum number
1419 of weights that can be assigned to an entry of the @code{LC_COLLATE}
1420 category @samp{order} keyword in a locale definition. Its value is
1421 @code{2}. @Theglibc{} does not presently support locale
1425 @node String Parameters
1426 @section String-Valued Parameters
1428 POSIX.2 defines a way to get string-valued parameters from the operating
1429 system with the function @code{confstr}:
1431 @deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})
1432 @standards{POSIX.2, unistd.h}
1433 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
1434 This function reads the value of a string-valued system parameter,
1435 storing the string into @var{len} bytes of memory space starting at
1436 @var{buf}. The @var{parameter} argument should be one of the
1437 @samp{_CS_} symbols listed below.
1439 The normal return value from @code{confstr} is the length of the string
1440 value that you asked for. If you supply a null pointer for @var{buf},
1441 then @code{confstr} does not try to store the string; it just returns
1442 its length. A value of @code{0} indicates an error.
1444 If the string you asked for is too long for the buffer (that is, longer
1445 than @code{@var{len} - 1}), then @code{confstr} stores just that much
1446 (leaving room for the terminating null character). You can tell that
1447 this has happened because @code{confstr} returns a value greater than or
1450 The following @code{errno} error conditions are defined for this function:
1454 The value of the @var{parameter} is invalid.
1458 Currently there is just one parameter you can read with @code{confstr}:
1462 @standards{POSIX.2, unistd.h}
1463 This parameter's value is the recommended default path for searching for
1464 executable files. This is the path that a user has by default just
1467 @item _CS_LFS_CFLAGS
1468 @standards{Unix98, unistd.h}
1469 The returned string specifies which additional flags must be given to
1470 the C compiler if a source is compiled using the
1471 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1473 @item _CS_LFS_LDFLAGS
1474 @standards{Unix98, unistd.h}
1475 The returned string specifies which additional flags must be given to
1476 the linker if a source is compiled using the
1477 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1480 @standards{Unix98, unistd.h}
1481 The returned string specifies which additional libraries must be linked
1482 to the application if a source is compiled using the
1483 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1485 @item _CS_LFS_LINTFLAGS
1486 @standards{Unix98, unistd.h}
1487 The returned string specifies which additional flags must be given to
1488 the lint tool if a source is compiled using the
1489 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1491 @item _CS_LFS64_CFLAGS
1492 @standards{Unix98, unistd.h}
1493 The returned string specifies which additional flags must be given to
1494 the C compiler if a source is compiled using the
1495 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1497 @item _CS_LFS64_LDFLAGS
1498 @standards{Unix98, unistd.h}
1499 The returned string specifies which additional flags must be given to
1500 the linker if a source is compiled using the
1501 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1503 @item _CS_LFS64_LIBS
1504 @standards{Unix98, unistd.h}
1505 The returned string specifies which additional libraries must be linked
1506 to the application if a source is compiled using the
1507 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1509 @item _CS_LFS64_LINTFLAGS
1510 @standards{Unix98, unistd.h}
1511 The returned string specifies which additional flags must be given to
1512 the lint tool if a source is compiled using the
1513 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1516 The way to use @code{confstr} without any arbitrary limit on string size
1517 is to call it twice: first call it to get the length, allocate the
1518 buffer accordingly, and then call @code{confstr} again to fill the
1524 get_default_path (void)
1526 size_t len = confstr (_CS_PATH, NULL, 0);
1527 char *buffer = (char *) xmalloc (len);
1529 if (confstr (_CS_PATH, buf, len + 1) == 0)