Update.
[glibc.git] / manual / conf.texi
blob64591ee9f27b73c8bfd4fdcbd60b3830818468d8
1 @node System Configuration, Language Features, System Information, Top
2 @chapter System Configuration Parameters
4 The functions and macros listed in this chapter give information about
5 configuration parameters of the operating system---for example, capacity
6 limits, presence of optional POSIX features, and the default path for
7 executable files (@pxref{String Parameters}).
9 @menu
10 * General Limits::           Constants and functions that describe
11                                 various process-related limits that have
12                                 one uniform value for any given machine.
13 * System Options::           Optional POSIX features.
14 * Version Supported::        Version numbers of POSIX.1 and POSIX.2.
15 * Sysconf::                  Getting specific configuration values
16                                 of general limits and system options.
17 * Minimums::                 Minimum values for general limits.
19 * Limits for Files::         Size limitations that pertain to individual files.
20                                 These can vary between file systems
21                                 or even from file to file.
22 * Options for Files::        Optional features that some files may support.
23 * File Minimums::            Minimum values for file limits.
24 * Pathconf::                 Getting the limit values for a particular file.
26 * Utility Limits::           Capacity limits of some POSIX.2 utility programs.
27 * Utility Minimums::         Minimum allowable values of those limits.
29 * String Parameters::        Getting the default search path.
30 @end menu
32 @node General Limits
33 @section General Capacity Limits
34 @cindex POSIX capacity limits
35 @cindex limits, POSIX
36 @cindex capacity limits, POSIX
38 The POSIX.1 and POSIX.2 standards specify a number of parameters that
39 describe capacity limitations of the system.  These limits can be fixed
40 constants for a given operating system, or they can vary from machine to
41 machine.  For example, some limit values may be configurable by the
42 system administrator, either at run time or by rebuilding the kernel,
43 and this should not require recompiling application programs.
45 @pindex limits.h
46 Each of the following limit parameters has a macro that is defined in
47 @file{limits.h} only if the system has a fixed, uniform limit for the
48 parameter in question.  If the system allows different file systems or
49 files to have different limits, then the macro is undefined; use
50 @code{sysconf} to find out the limit that applies at a particular time
51 on a particular machine.  @xref{Sysconf}.
53 Each of these parameters also has another macro, with a name starting
54 with @samp{_POSIX}, which gives the lowest value that the limit is
55 allowed to have on @emph{any} POSIX system.  @xref{Minimums}.
57 @cindex limits, program argument size
58 @comment limits.h
59 @comment POSIX.1
60 @deftypevr Macro int ARG_MAX
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.
63 @end deftypevr
65 @cindex limits, number of processes
66 @comment limits.h
67 @comment POSIX.1
68 @deftypevr Macro int CHILD_MAX
69 If defined, the unvarying maximum number of processes that can exist
70 with the same real user ID at any one time.  In BSD and GNU, this is
71 controlled by the @code{RLIMIT_NPROC} resource limit; @pxref{Limits on
72 Resources}.
73 @end deftypevr
75 @cindex limits, number of open files
76 @comment limits.h
77 @comment POSIX.1
78 @deftypevr Macro int OPEN_MAX
79 If defined, the unvarying maximum number of files that a single process
80 can have open simultaneously.  In BSD and GNU, this is controlled
81 by the @code{RLIMIT_NOFILE} resource limit; @pxref{Limits on Resources}.
82 @end deftypevr
84 @comment limits.h
85 @comment POSIX.1
86 @deftypevr Macro int STREAM_MAX
87 If defined, the unvarying maximum number of streams that a single
88 process can have open simultaneously.  @xref{Opening Streams}.
89 @end deftypevr
91 @cindex limits, time zone name length
92 @comment limits.h
93 @comment POSIX.1
94 @deftypevr Macro int TZNAME_MAX
95 If defined, the unvarying maximum length of a time zone name.
96 @xref{Time Zone Functions}.
97 @end deftypevr
99 These limit macros are always defined in @file{limits.h}.
101 @cindex limits, number of supplementary group IDs
102 @comment limits.h
103 @comment POSIX.1
104 @deftypevr Macro int NGROUPS_MAX
105 The maximum number of supplementary group IDs that one process can have.
107 The value of this macro is actually a lower bound for the maximum.  That
108 is, you can count on being able to have that many supplementary group
109 IDs, but a particular machine might let you have even more.  You can use
110 @code{sysconf} to see whether a particular machine will let you have
111 more (@pxref{Sysconf}).
112 @end deftypevr
114 @comment limits.h
115 @comment POSIX.1
116 @deftypevr Macro int SSIZE_MAX
117 The largest value that can fit in an object of type @code{ssize_t}.
118 Effectively, this is the limit on the number of bytes that can be read
119 or written in a single operation.
121 This macro is defined in all POSIX systems because this limit is never
122 configurable.
123 @end deftypevr
125 @comment limits.h
126 @comment POSIX.2
127 @deftypevr Macro int RE_DUP_MAX
128 The largest number of repetitions you are guaranteed is allowed in the
129 construct @samp{\@{@var{min},@var{max}\@}} in a regular expression.
131 The value of this macro is actually a lower bound for the maximum.  That
132 is, you can count on being able to have that many repetitions, but a
133 particular machine might let you have even more.  You can use
134 @code{sysconf} to see whether a particular machine will let you have
135 more (@pxref{Sysconf}).  And even the value that @code{sysconf} tells
136 you is just a lower bound---larger values might work.
138 This macro is defined in all POSIX.2 systems, because POSIX.2 says it
139 should always be defined even if there is no specific imposed limit.
140 @end deftypevr
142 @node System Options
143 @section Overall System Options
144 @cindex POSIX optional features
145 @cindex optional POSIX features
147 POSIX defines certain system-specific options that not all POSIX systems
148 support.  Since these options are provided in the kernel, not in the
149 library, simply using the GNU C library does not guarantee any of these
150 features is supported; it depends on the system you are using.
152 @pindex unistd.h
153 You can test for the availability of a given option using the macros in
154 this section, together with the function @code{sysconf}.  The macros are
155 defined only if you include @file{unistd.h}.
157 For the following macros, if the macro is defined in @file{unistd.h},
158 then the option is supported.  Otherwise, the option may or may not be
159 supported; use @code{sysconf} to find out.  @xref{Sysconf}.
161 @comment unistd.h
162 @comment POSIX.1
163 @deftypevr Macro int _POSIX_JOB_CONTROL
164 If this symbol is defined, it indicates that the system supports job
165 control.  Otherwise, the implementation behaves as if all processes
166 within a session belong to a single process group.  @xref{Job Control}.
167 @end deftypevr
169 @comment unistd.h
170 @comment POSIX.1
171 @deftypevr Macro int _POSIX_SAVED_IDS
172 If this symbol is defined, it indicates that the system remembers the
173 effective user and group IDs of a process before it executes an
174 executable file with the set-user-ID or set-group-ID bits set, and that
175 explicitly changing the effective user or group IDs back to these values
176 is permitted.  If this option is not defined, then if a nonprivileged
177 process changes its effective user or group ID to the real user or group
178 ID of the process, it can't change it back again.  @xref{Enable/Disable
179 Setuid}.
180 @end deftypevr
182 For the following macros, if the macro is defined in @file{unistd.h},
183 then its value indicates whether the option is supported.  A value of
184 @code{-1} means no, and any other value means yes.  If the macro is not
185 defined, then the option may or may not be supported; use @code{sysconf}
186 to find out.  @xref{Sysconf}.
188 @comment unistd.h
189 @comment POSIX.2
190 @deftypevr Macro int _POSIX2_C_DEV
191 If this symbol is defined, it indicates that the system has the POSIX.2
192 C compiler command, @code{c89}.  The GNU C library always defines this
193 as @code{1}, on the assumption that you would not have installed it if
194 you didn't have a C compiler.
195 @end deftypevr
197 @comment unistd.h
198 @comment POSIX.2
199 @deftypevr Macro int _POSIX2_FORT_DEV
200 If this symbol is defined, it indicates that the system has the POSIX.2
201 Fortran compiler command, @code{fort77}.  The GNU C library never
202 defines this, because we don't know what the system has.
203 @end deftypevr
205 @comment unistd.h
206 @comment POSIX.2
207 @deftypevr Macro int _POSIX2_FORT_RUN
208 If this symbol is defined, it indicates that the system has the POSIX.2
209 @code{asa} command to interpret Fortran carriage control.  The GNU C
210 library never defines this, because we don't know what the system has.
211 @end deftypevr
213 @comment unistd.h
214 @comment POSIX.2
215 @deftypevr Macro int _POSIX2_LOCALEDEF
216 If this symbol is defined, it indicates that the system has the POSIX.2
217 @code{localedef} command.  The GNU C library never defines this, because
218 we don't know what the system has.
219 @end deftypevr
221 @comment unistd.h
222 @comment POSIX.2
223 @deftypevr Macro int _POSIX2_SW_DEV
224 If this symbol is defined, it indicates that the system has the POSIX.2
225 commands @code{ar}, @code{make}, and @code{strip}.  The GNU C library
226 always defines this as @code{1}, on the assumption that you had to have
227 @code{ar} and @code{make} to install the library, and it's unlikely that
228 @code{strip} would be absent when those are present.
229 @end deftypevr
231 @node Version Supported
232 @section Which Version of POSIX is Supported
234 @comment unistd.h
235 @comment POSIX.1
236 @deftypevr Macro {long int} _POSIX_VERSION
237 This constant represents the version of the POSIX.1 standard to which
238 the implementation conforms.  For an implementation conforming to the
239 1995 POSIX.1 standard, the value is the integer @code{199506L}.
241 @code{_POSIX_VERSION} is always defined (in @file{unistd.h}) in any
242 POSIX system.
244 @strong{Usage Note:} Don't try to test whether the system supports POSIX
245 by including @file{unistd.h} and then checking whether
246 @code{_POSIX_VERSION} is defined.  On a non-POSIX system, this will
247 probably fail because there is no @file{unistd.h}.  We do not know of
248 @emph{any} way you can reliably test at compilation time whether your
249 target system supports POSIX or whether @file{unistd.h} exists.
251 The GNU C compiler predefines the symbol @code{__POSIX__} if the target
252 system is a POSIX system.  Provided you do not use any other compilers
253 on POSIX systems, testing @code{defined (__POSIX__)} will reliably
254 detect such systems.
255 @end deftypevr
257 @comment unistd.h
258 @comment POSIX.2
259 @deftypevr Macro {long int} _POSIX2_C_VERSION
260 This constant represents the version of the POSIX.2 standard which the
261 library and system kernel support.  We don't know what value this will
262 be for the first version of the POSIX.2 standard, because the value is
263 based on the year and month in which the standard is officially adopted.
265 The value of this symbol says nothing about the utilities installed on
266 the system.
268 @strong{Usage Note:} You can use this macro to tell whether a POSIX.1
269 system library supports POSIX.2 as well.  Any POSIX.1 system contains
270 @file{unistd.h}, so include that file and then test @code{defined
271 (_POSIX2_C_VERSION)}.
272 @end deftypevr
274 @node Sysconf
275 @section Using @code{sysconf}
277 When your system has configurable system limits, you can use the
278 @code{sysconf} function to find out the value that applies to any
279 particular machine.  The function and the associated @var{parameter}
280 constants are declared in the header file @file{unistd.h}.
282 @menu
283 * Sysconf Definition::        Detailed specifications of @code{sysconf}.
284 * Constants for Sysconf::     The list of parameters @code{sysconf} can read.
285 * Examples of Sysconf::       How to use @code{sysconf} and the parameter
286                                  macros properly together.
287 @end menu
289 @node Sysconf Definition
290 @subsection Definition of @code{sysconf}
292 @comment unistd.h
293 @comment POSIX.1
294 @deftypefun {long int} sysconf (int @var{parameter})
295 This function is used to inquire about runtime system parameters.  The
296 @var{parameter} argument should be one of the @samp{_SC_} symbols listed
297 below.
299 The normal return value from @code{sysconf} is the value you requested.
300 A value of @code{-1} is returned both if the implementation does not
301 impose a limit, and in case of an error.
303 The following @code{errno} error conditions are defined for this function:
305 @table @code
306 @item EINVAL
307 The value of the @var{parameter} is invalid.
308 @end table
309 @end deftypefun
311 @node Constants for Sysconf
312 @subsection Constants for @code{sysconf} Parameters
314 Here are the symbolic constants for use as the @var{parameter} argument
315 to @code{sysconf}.  The values are all integer constants (more
316 specifically, enumeration type values).
318 @table @code
319 @comment unistd.h
320 @comment POSIX.1
321 @item _SC_ARG_MAX
322 Inquire about the parameter corresponding to @code{ARG_MAX}.
324 @comment unistd.h
325 @comment POSIX.1
326 @item _SC_CHILD_MAX
327 Inquire about the parameter corresponding to @code{CHILD_MAX}.
329 @comment unistd.h
330 @comment POSIX.1
331 @item _SC_OPEN_MAX
332 Inquire about the parameter corresponding to @code{OPEN_MAX}.
334 @comment unistd.h
335 @comment POSIX.1
336 @item _SC_STREAM_MAX
337 Inquire about the parameter corresponding to @code{STREAM_MAX}.
339 @comment unistd.h
340 @comment POSIX.1
341 @item _SC_TZNAME_MAX
342 Inquire about the parameter corresponding to @code{TZNAME_MAX}.
344 @comment unistd.h
345 @comment POSIX.1
346 @item _SC_NGROUPS_MAX
347 Inquire about the parameter corresponding to @code{NGROUPS_MAX}.
349 @comment unistd.h
350 @comment POSIX.1
351 @item _SC_JOB_CONTROL
352 Inquire about the parameter corresponding to @code{_POSIX_JOB_CONTROL}.
354 @comment unistd.h
355 @comment POSIX.1
356 @item _SC_SAVED_IDS
357 Inquire about the parameter corresponding to @code{_POSIX_SAVED_IDS}.
359 @comment unistd.h
360 @comment POSIX.1
361 @item _SC_VERSION
362 Inquire about the parameter corresponding to @code{_POSIX_VERSION}.
364 @comment unistd.h
365 @comment POSIX.1
366 @item _SC_CLK_TCK
367 Inquire about the parameter corresponding to @code{CLOCKS_PER_SEC};
368 @pxref{Basic CPU Time}.
370 @comment unistd.h
371 @comment GNU
372 @item _SC_CHARCLASS_NAME_MAX
373 Inquire about the parameter corresponding to maximal length allowed for
374 a character class name in an extended locale specification.  These
375 extensions are not yet standardized and so this option is not standardized
376 as well.
378 @comment unistdh.h
379 @comment POSIX.1
380 @item _SC_REALTIME_SIGNALS
381 Inquire about the parameter corresponding to @code{_POSIX_REALTIME_SIGNALS}.
383 @comment unistd.h
384 @comment POSIX.1
385 @item _SC_PRIORITY_SCHEDULING
386 Inquire about the parameter corresponding to @code{_POSIX_PRIORITY_SCHEDULING}.
388 @comment unistd.h
389 @comment POSIX.1
390 @item _SC_TIMERS
391 Inquire about the parameter corresponding to @code{_POSIX_TIMERS}.
393 @comment unistd.h
394 @comment POSIX.1
395 @item _SC_ASYNCHRONOUS_IO
396 Inquire about the parameter corresponding to @code{_POSIX_ASYNCHRONOUS_IO}.
398 @comment unistd.h
399 @comment POSIX.1
400 @item _SC_PRIORITIZED_IO
401 Inquire about the parameter corresponding to @code{_POSIX_PRIORITIZED_IO}.
403 @comment unistd.h
404 @comment POSIX.1
405 @item _SC_SYNCHRONIZED_IO
406 Inquire about the parameter corresponding to @code{_POSIX_SYNCHRONIZED_IO}.
408 @comment unistd.h
409 @comment POSIX.1
410 @item _SC_FSYNC
411 Inquire about the parameter corresponding to @code{_POSIX_FSYNC}.
413 @comment unistd.h
414 @comment POSIX.1
415 @item _SC_MAPPED_FILES
416 Inquire about the parameter corresponding to @code{_POSIX_MAPPED_FILES}.
418 @comment unistd.h
419 @comment POSIX.1
420 @item _SC_MEMLOCK
421 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK}.
423 @comment unistd.h
424 @comment POSIX.1
425 @item _SC_MEMLOCK_RANGE
426 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK_RANGE}.
428 @comment unistd.h
429 @comment POSIX.1
430 @item _SC_MEMORY_PROTECTION
431 Inquire about the parameter corresponding to @code{_POSIX_MEMORY_PROTECTION}.
433 @comment unistd.h
434 @comment POSIX.1
435 @item _SC_MESSAGE_PASSING
436 Inquire about the parameter corresponding to @code{_POSIX_MESSAGE_PASSING}.
438 @comment unistd.h
439 @comment POSIX.1
440 @item _SC_SEMAPHORES
441 Inquire about the parameter corresponding to @code{_POSIX_SEMAPHORES}.
443 @comment unistd.h
444 @comment POSIX.1
445 @item _SC_SHARED_MEMORY_OBJECTS
446 Inquire about the parameter corresponding to
447 @code{_POSIX_SHARED_MEMORY_OBJECTS}.
449 @comment unistd.h
450 @comment POSIX.1
451 @item _SC_AIO_LISTIO_MAX
452 Inquire about the parameter corresponding to @code{_POSIX_AIO_LISTIO_MAX}.
454 @comment unistd.h
455 @comment POSIX.1
456 @item _SC_AIO_MAX
457 Inquire about the parameter corresponding to @code{_POSIX_AIO_MAX}.
459 @comment unistd.h
460 @comment POSIX.1
461 @item _SC_AIO_PRIO_DELTA_MAX
462 Inquire the value by which a process can decrease its asynchronous I/O
463 priority level from its own scheduling priority.  This corresponds to the
464 run-time invariant value @code{AIO_PRIO_DELTA_MAX}.
466 @comment unistd.h
467 @comment POSIX.1
468 @item _SC_DELAYTIMER_MAX
469 Inquire about the parameter corresponding to @code{_POSIX_DELAYTIMER_MAX}.
471 @comment unistd.h
472 @comment POSIX.1
473 @item _SC_MQ_OPEN_MAX
474 Inquire about the parameter corresponding to @code{_POSIX_MQ_OPEN_MAX}.
476 @comment unistd.h
477 @comment POSIX.1
478 @item _SC_MQ_PRIO_MAX
479 Inquire about the parameter corresponding to @code{_POSIX_MQ_PRIO_MAX}.
481 @comment unistd.h
482 @comment POSIX.1
483 @item _SC_RTSIG_MAX
484 Inquire about the parameter corresponding to @code{_POSIX_RTSIG_MAX}.
486 @comment unistd.h
487 @comment POSIX.1
488 @item _SC_SEM_NSEMS_MAX
489 Inquire about the parameter corresponding to @code{_POSIX_SEM_NSEMS_MAX}.
491 @comment unistd.h
492 @comment POSIX.1
493 @item _SC_SEM_VALUE_MAX
494 Inquire about the parameter corresponding to @code{_POSIX_SEM_VALUE_MAX}.
496 @comment unistd.h
497 @comment POSIX.1
498 @item _SC_SIGQUEUE_MAX
499 Inquire about the parameter corresponding to @code{_POSIX_SIGQUEUE_MAX}.
501 @comment unistd.h
502 @comment POSIX.1
503 @item _SC_TIMER_MAX
504 Inquire about the parameter corresponding to @code{_POSIX_TIMER_MAX}.
506 @comment unistd.h
507 @comment POSIX.1g
508 @item _SC_PII
509 Inquire about the parameter corresponding to @code{_POSIX_PII}.
511 @comment unistd.h
512 @comment POSIX.1g
513 @item _SC_PII_XTI
514 Inquire about the parameter corresponding to @code{_POSIX_PII_XTI}.
516 @comment unistd.h
517 @comment POSIX.1g
518 @item _SC_PII_SOCKET
519 Inquire about the parameter corresponding to @code{_POSIX_PII_SOCKET}.
521 @comment unistd.h
522 @comment POSIX.1g
523 @item _SC_PII_INTERNET
524 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET}.
526 @comment unistd.h
527 @comment POSIX.1g
528 @item _SC_PII_OSI
529 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI}.
531 @comment unistd.h
532 @comment POSIX.1g
533 @item _SC_SELECT
534 Inquire about the parameter corresponding to @code{_POSIX_SELECT}.
536 @comment unistd.h
537 @comment POSIX.1g
538 @item _SC_UIO_MAXIOV
539 Inquire about the parameter corresponding to @code{_POSIX_UIO_MAXIOV}.
541 @comment unistd.h
542 @comment POSIX.1g
543 @item _SC_PII_INTERNET_STREAM
544 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_STREAM}.
546 @comment unistd.h
547 @comment POSIX.1g
548 @item _SC_PII_INTERNET_DGRAM
549 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_DGRAM}.
551 @comment unistd.h
552 @comment POSIX.1g
553 @item _SC_PII_OSI_COTS
554 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_COTS}.
556 @comment unistd.h
557 @comment POSIX.1g
558 @item _SC_PII_OSI_CLTS
559 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_CLTS}.
561 @comment unistd.h
562 @comment POSIX.1g
563 @item _SC_PII_OSI_M
564 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_M}.
566 @comment unistd.h
567 @comment POSIX.1g
568 @item _SC_T_IOV_MAX
569 Inquire the value of the value associated with the @code{T_IOV_MAX}
570 variable.
572 @comment unistd.h
573 @comment POSIX.1
574 @item _SC_THREADS
575 Inquire about the parameter corresponding to @code{_POSIX_THREADS}.
577 @comment unistd.h
578 @comment POSIX.1
579 @item _SC_THREAD_SAFE_FUNCTIONS
580 Inquire about the parameter corresponding to
581 @code{_POSIX_THREAD_SAFE_FUNCTIONS}.
583 @comment unistd.h
584 @comment POSIX.1
585 @item _SC_GETGR_R_SIZE_MAX
586 Inquire about the parameter corresponding to @code{_POSIX_GETGR_R_SIZE_MAX}.
588 @comment unistd.h
589 @comment POSIX.1
590 @item _SC_GETPW_R_SIZE_MAX
591 Inquire about the parameter corresponding to @code{_POSIX_GETPW_R_SIZE_MAX}.
593 @comment unistd.h
594 @comment POSIX.1
595 @item _SC_LOGIN_NAME_MAX
596 Inquire about the parameter corresponding to @code{_POSIX_LOGIN_NAME_MAX}.
598 @comment unistd.h
599 @comment POSIX.1
600 @item _SC_TTY_NAME_MAX
601 Inquire about the parameter corresponding to @code{_POSIX_TTY_NAME_MAX}.
603 @comment unistd.h
604 @comment POSIX.1
605 @item _SC_THREAD_DESTRUCTOR_ITERATIONS
606 Inquire about the parameter corresponding to
607 @code{_POSIX_THREAD_DESTRUCTOR_ITERATIONS}.
609 @comment unistd.h
610 @comment POSIX.1
611 @item _SC_THREAD_KEYS_MAX
612 Inquire about the parameter corresponding to @code{_POSIX_THREAD_KEYS_MAX}.
614 @comment unistd.h
615 @comment POSIX.1
616 @item _SC_THREAD_STACK_MIN
617 Inquire about the parameter corresponding to @code{_POSIX_THREAD_STACK_MIN}.
619 @comment unistd.h
620 @comment POSIX.1
621 @item _SC_THREAD_THREADS_MAX
622 Inquire about the parameter corresponding to @code{_POSIX_THREAD_THREADS_MAX}.
624 @comment unistd.h
625 @comment POSIX.1
626 @item _SC_THREAD_ATTR_STACKADDR
627 Inquire about the parameter corresponding to
628 @code{_POSIX_THREAD_ATTR_STACKADDR}.
630 @comment unistd.h
631 @comment POSIX.1
632 @item _SC_THREAD_ATTR_STACKSIZE
633 Inquire about the parameter corresponding to
634 @code{_POSIX_THREAD_ATTR_STACKSIZE}.
636 @comment unistd.h
637 @comment POSIX.1
638 @item _SC_THREAD_PRIORITY_SCHEDULING
639 Inquire about the parameter corresponding to
640 @code{_POSIX_THREAD_PRIORITY_SCHEDULING}.
642 @comment unistd.h
643 @comment POSIX.1
644 @item _SC_THREAD_PRIO_INHERIT
645 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_INHERIT}.
647 @comment unistd.h
648 @comment POSIX.1
649 @item _SC_THREAD_PRIO_PROTECT
650 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_PROTECT}.
652 @comment unistd.h
653 @comment POSIX.1
654 @item _SC_THREAD_PROCESS_SHARED
655 Inquire about the parameter corresponding to
656 @code{_POSIX_THREAD_PROCESS_SHARED}.
658 @comment unistd.h
659 @comment POSIX.2
660 @item _SC_2_C_DEV
661 Inquire about whether the system has the POSIX.2 C compiler command,
662 @code{c89}.
664 @comment unistd.h
665 @comment POSIX.2
666 @item _SC_2_FORT_DEV
667 Inquire about whether the system has the POSIX.2 Fortran compiler
668 command, @code{fort77}.
670 @comment unistd.h
671 @comment POSIX.2
672 @item _SC_2_FORT_RUN
673 Inquire about whether the system has the POSIX.2 @code{asa} command to
674 interpret Fortran carriage control.
676 @comment unistd.h
677 @comment POSIX.2
678 @item _SC_2_LOCALEDEF
679 Inquire about whether the system has the POSIX.2 @code{localedef}
680 command.
682 @comment unistd.h
683 @comment POSIX.2
684 @item _SC_2_SW_DEV
685 Inquire about whether the system has the POSIX.2 commands @code{ar},
686 @code{make}, and @code{strip}.
688 @comment unistd.h
689 @comment POSIX.2
690 @item _SC_BC_BASE_MAX
691 Inquire about the maximum value of @code{obase} in the @code{bc}
692 utility.
694 @comment unistd.h
695 @comment POSIX.2
696 @item _SC_BC_DIM_MAX
697 Inquire about the maximum size of an array in the @code{bc}
698 utility.
700 @comment unistd.h
701 @comment POSIX.2
702 @item _SC_BC_SCALE_MAX
703 Inquire about the maximum value of @code{scale} in the @code{bc}
704 utility.
706 @comment unistd.h
707 @comment POSIX.2
708 @item _SC_BC_STRING_MAX
709 Inquire about the maximum size of a string constant in the
710 @code{bc} utility.
712 @comment unistd.h
713 @comment POSIX.2
714 @item _SC_COLL_WEIGHTS_MAX
715 Inquire about the maximum number of weights that can necessarily
716 be used in defining the collating sequence for a locale.
718 @comment unistd.h
719 @comment POSIX.2
720 @item _SC_EXPR_NEST_MAX
721 Inquire about the maximum number of expressions nested within
722 parentheses when using the @code{expr} utility.
724 @comment unistd.h
725 @comment POSIX.2
726 @item _SC_LINE_MAX
727 Inquire about the maximum size of a text line that the POSIX.2 text
728 utilities can handle.
730 @comment unistd.h
731 @comment POSIX.2
732 @item _SC_EQUIV_CLASS_MAX
733 Inquire about the maximum number of weights that can be assigned to an
734 entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale
735 definition.  The GNU C library does not presently support locale
736 definitions.
738 @comment unistd.h
739 @comment POSIX.2
740 @item _SC_VERSION
741 Inquire about the version number of POSIX.1 that the library and kernel
742 support.
744 @comment unistd.h
745 @comment POSIX.2
746 @item _SC_2_VERSION
747 Inquire about the version number of POSIX.2 that the system utilities
748 support.
750 @comment unistd.h
751 @comment GNU
752 @item _SC_PAGESIZE
753 Inquire about the virtual memory page size of the machine.
754 @code{getpagesize} returns the same value.
755 @c @xref{XXX getpagesize}. !!! ???
757 @comment unistd.h
758 @comment GNU
759 @item _SC_NPROCESSORS_CONF
760 Inquire about number of configured processors.
762 @comment unistd.h
763 @comment GNU
764 @item _SC_NPROCESSORS_ONLN
765 Inquire about number of processors online.
767 @comment unistd.h
768 @comment GNU
769 @item _SC_PHYS_PAGES
770 Inquire about number of physical pages in the system.
772 @comment unistd.h
773 @comment GNU
774 @item _SC_AVPHYS_PAGES
775 Inquire about number of available physical pages in the system.
777 @comment unistd.h
778 @comment GNU
779 @item _SC_ATEXIT_MAX
780 Inquire about number of functions which can be registered as termination
781 functions for @code{atexit}; @pxref{Cleanups on Exit}.
783 @comment unistd.h
784 @comment X/Open
785 @item _SC_XOPEN_VERSION
786 Inquire about the parameter corresponding to @code{_XOPEN_VERSION}.
788 @comment unistd.h
789 @comment X/Open
790 @item _SC_XOPEN_XCU_VERSION
791 Inquire about the parameter corresponding to @code{_XOPEN_XCU_VERSION}.
793 @comment unistd.h
794 @comment X/Open
795 @item _SC_XOPEN_UNIX
796 Inquire about the parameter corresponding to @code{_XOPEN_UNIX}.
798 @comment unistd.h
799 @comment X/Open
800 @item _SC_XOPEN_CRYPT
801 Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
803 @comment unistd.h
804 @comment X/Open
805 @item _SC_XOPEN_ENH_I18N
806 Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
808 @comment unistd.h
809 @comment X/Open
810 @item _SC_XOPEN_SHM
811 Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
813 @comment unistd.h
814 @comment X/Open
815 @item _SC_XOPEN_XPG2
816 Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
818 @comment unistd.h
819 @comment X/Open
820 @item _SC_XOPEN_XPG3
821 Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
823 @comment unistd.h
824 @comment X/Open
825 @item _SC_XOPEN_XPG4
826 Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
828 @comment unistd.h
829 @comment X/Open
830 @item _SC_CHAR_BIT
831 Inquire about number of bits in a variable of type @code{char}.
833 @comment unistd.h
834 @comment X/Open
835 @item _SC_CHAR_MAX
836 Inquire about maximum value which can be stored in a variable of type
837 @code{char}.
839 @comment unistd.h
840 @comment X/Open
841 @item _SC_CHAR_MIN
842 Inquire about minimum value which can be stored in a variable of type
843 @code{char}.
845 @comment unistd.h
846 @comment X/Open
847 @item _SC_INT_MAX
848 Inquire about maximum value which can be stored in a variable of type
849 @code{int}.
851 @comment unistd.h
852 @comment X/Open
853 @item _SC_INT_MIN
854 Inquire about minimum value which can be stored in a variable of type
855 @code{int}.
857 @comment unistd.h
858 @comment X/Open
859 @item _SC_LONG_BIT
860 Inquire about number of bits in a variable of type @code{long int}.
862 @comment unistd.h
863 @comment X/Open
864 @item _SC_WORD_BIT
865 Inquire about number of bits in a variable of a register word.
867 @comment unistd.h
868 @comment X/Open
869 @item _SC_MB_LEN_MAX
870 Inquire the maximum length of a multi-byte representation of a wide
871 character value.
873 @comment unistd.h
874 @comment X/Open
875 @item _SC_NZERO
876 Inquire value used to internally represent the zero priority level for
877 the process execution.
879 @comment unistd.h
880 @comment X/Open
881 @item SC_SSIZE_MAX
882 Inquire about maximum value which can be stored in a variable of type
883 @code{ssize_t}.
885 @comment unistd.h
886 @comment X/Open
887 @item _SC_SCHAR_MAX
888 Inquire about maximum value which can be stored in a variable of type
889 @code{signed char}.
891 @comment unistd.h
892 @comment X/Open
893 @item _SC_SCHAR_MIN
894 Inquire about minimum value which can be stored in a variable of type
895 @code{signed char}.
897 @comment unistd.h
898 @comment X/Open
899 @item _SC_SHRT_MAX
900 Inquire about maximum value which can be stored in a variable of type
901 @code{short int}.
903 @comment unistd.h
904 @comment X/Open
905 @item _SC_SHRT_MIN
906 Inquire about minimum value which can be stored in a variable of type
907 @code{short int}.
909 @comment unistd.h
910 @comment X/Open
911 @item _SC_UCHAR_MAX
912 Inquire about maximum value which can be stored in a variable of type
913 @code{unsigned char}.
915 @comment unistd.h
916 @comment X/Open
917 @item _SC_UINT_MAX
918 Inquire about maximum value which can be stored in a variable of type
919 @code{unsigned int}.
921 @comment unistd.h
922 @comment X/Open
923 @item _SC_ULONG_MAX
924 Inquire about maximum value which can be stored in a variable of type
925 @code{unsigned long int}.
927 @comment unistd.h
928 @comment X/Open
929 @item _SC_USHRT_MAX
930 Inquire about maximum value which can be stored in a variable of type
931 @code{unsigned short int}.
933 @comment unistd.h
934 @comment X/Open
935 @item _SC_NL_ARGMAX
936 Inquire about the parameter corresponding to @code{NL_ARGMAX}.
938 @comment unistd.h
939 @comment X/Open
940 @item _SC_NL_LANGMAX
941 Inquire about the parameter corresponding to @code{NL_LANGMAX}.
943 @comment unistd.h
944 @comment X/Open
945 @item _SC_NL_MSGMAX
946 Inquire about the parameter corresponding to @code{NL_MSGMAX}.
948 @comment unistd.h
949 @comment X/Open
950 @item _SC_NL_NMAX
951 Inquire about  the parameter corresponding to @code{NL_NMAX}.
953 @comment unistd.h
954 @comment X/Open
955 @item _SC_NL_SETMAX
956 Inquire about  the parameter corresponding to @code{NL_SETMAX}.
958 @comment unistd.h
959 @comment X/Open
960 @item _SC_NL_TEXTMAX
961 Inquire about  the parameter corresponding to @code{NL_TEXTMAX}.
962 @end table
964 @node Examples of Sysconf
965 @subsection Examples of @code{sysconf}
967 We recommend that you first test for a macro definition for the
968 parameter you are interested in, and call @code{sysconf} only if the
969 macro is not defined.  For example, here is how to test whether job
970 control is supported:
972 @smallexample
973 @group
975 have_job_control (void)
977 #ifdef _POSIX_JOB_CONTROL
978   return 1;
979 #else
980   int value = sysconf (_SC_JOB_CONTROL);
981   if (value < 0)
982     /* @r{If the system is that badly wedged,}
983        @r{there's no use trying to go on.}  */
984     fatal (strerror (errno));
985   return value;
986 #endif
988 @end group
989 @end smallexample
991 Here is how to get the value of a numeric limit:
993 @smallexample
995 get_child_max ()
997 #ifdef CHILD_MAX
998   return CHILD_MAX;
999 #else
1000   int value = sysconf (_SC_CHILD_MAX);
1001   if (value < 0)
1002     fatal (strerror (errno));
1003   return value;
1004 #endif
1006 @end smallexample
1008 @node Minimums
1009 @section Minimum Values for General Capacity Limits
1011 Here are the names for the POSIX minimum upper bounds for the system
1012 limit parameters.  The significance of these values is that you can
1013 safely push to these limits without checking whether the particular
1014 system you are using can go that far.
1016 @table @code
1017 @comment limits.h
1018 @comment POSIX.1
1019 @item _POSIX_AIO_LISTIO_MAX
1020 The most restrictive limit permitted by POSIX for the maximum number of
1021 I/O operations that can be specified in a list I/O call.  The value of
1022 this constant is @code{2}; thus you can add up to two new entries
1023 of the list of outstandard operations.
1025 @comment limits.h
1026 @comment POSIX.1
1027 @item _POSIX_AIO_MAX
1028 The most restrictive limit permitted by POSIX for the maximum number of
1029 outstanding asynchronous I/O operations.  The value of this constant is
1030 @code{1}.  So you cannot expect that you can issue more than one
1031 operation and immediately continue with the normal work, receiving the
1032 notifications asynchronously.
1034 @comment limits.h
1035 @comment POSIX.1
1036 @item _POSIX_ARG_MAX
1037 The value of this macro is the most restrictive limit permitted by POSIX
1038 for the maximum combined length of the @var{argv} and @var{environ}
1039 arguments that can be passed to the @code{exec} functions.
1040 Its value is @code{4096}.
1042 @comment limits.h
1043 @comment POSIX.1
1044 @item _POSIX_CHILD_MAX
1045 The value of this macro is the most restrictive limit permitted by POSIX
1046 for the maximum number of simultaneous processes per real user ID.  Its
1047 value is @code{6}.
1049 @comment limits.h
1050 @comment POSIX.1
1051 @item _POSIX_NGROUPS_MAX
1052 The value of this macro is the most restrictive limit permitted by POSIX
1053 for the maximum number of supplementary group IDs per process.  Its
1054 value is @code{0}.
1056 @comment limits.h
1057 @comment POSIX.1
1058 @item _POSIX_OPEN_MAX
1059 The value of this macro is the most restrictive limit permitted by POSIX
1060 for the maximum number of files that a single process can have open
1061 simultaneously.  Its value is @code{16}.
1063 @comment limits.h
1064 @comment POSIX.1
1065 @item _POSIX_SSIZE_MAX
1066 The value of this macro is the most restrictive limit permitted by POSIX
1067 for the maximum value that can be stored in an object of type
1068 @code{ssize_t}.  Its value is @code{32767}.
1070 @comment limits.h
1071 @comment POSIX.1
1072 @item _POSIX_STREAM_MAX
1073 The value of this macro is the most restrictive limit permitted by POSIX
1074 for the maximum number of streams that a single process can have open
1075 simultaneously.  Its value is @code{8}.
1077 @comment limits.h
1078 @comment POSIX.1
1079 @item _POSIX_TZNAME_MAX
1080 The value of this macro is the most restrictive limit permitted by POSIX
1081 for the maximum length of a time zone name.  Its value is @code{3}.
1083 @comment limits.h
1084 @comment POSIX.2
1085 @item _POSIX2_RE_DUP_MAX
1086 The value of this macro is the most restrictive limit permitted by POSIX
1087 for the numbers used in the @samp{\@{@var{min},@var{max}\@}} construct
1088 in a regular expression.  Its value is @code{255}.
1089 @end table
1091 @node Limits for Files
1092 @section Limits on File System Capacity
1094 The POSIX.1 standard specifies a number of parameters that describe the
1095 limitations of the file system.  It's possible for the system to have a
1096 fixed, uniform limit for a parameter, but this isn't the usual case.  On
1097 most systems, it's possible for different file systems (and, for some
1098 parameters, even different files) to have different maximum limits.  For
1099 example, this is very likely if you use NFS to mount some of the file
1100 systems from other machines.
1102 @pindex limits.h
1103 Each of the following macros is defined in @file{limits.h} only if the
1104 system has a fixed, uniform limit for the parameter in question.  If the
1105 system allows different file systems or files to have different limits,
1106 then the macro is undefined; use @code{pathconf} or @code{fpathconf} to
1107 find out the limit that applies to a particular file.  @xref{Pathconf}.
1109 Each parameter also has another macro, with a name starting with
1110 @samp{_POSIX}, which gives the lowest value that the limit is allowed to
1111 have on @emph{any} POSIX system.  @xref{File Minimums}.
1113 @cindex limits, link count of files
1114 @comment limits.h
1115 @comment POSIX.1
1116 @deftypevr Macro int LINK_MAX
1117 The uniform system limit (if any) for the number of names for a given
1118 file.  @xref{Hard Links}.
1119 @end deftypevr
1121 @cindex limits, terminal input queue
1122 @comment limits.h
1123 @comment POSIX.1
1124 @deftypevr Macro int MAX_CANON
1125 The uniform system limit (if any) for the amount of text in a line of
1126 input when input editing is enabled.  @xref{Canonical or Not}.
1127 @end deftypevr
1129 @comment limits.h
1130 @comment POSIX.1
1131 @deftypevr Macro int MAX_INPUT
1132 The uniform system limit (if any) for the total number of characters
1133 typed ahead as input.  @xref{I/O Queues}.
1134 @end deftypevr
1136 @cindex limits, file name length
1137 @comment limits.h
1138 @comment POSIX.1
1139 @deftypevr Macro int NAME_MAX
1140 The uniform system limit (if any) for the length of a file name component.
1141 @end deftypevr
1143 @comment limits.h
1144 @comment POSIX.1
1145 @deftypevr Macro int PATH_MAX
1146 The uniform system limit (if any) for the length of an entire file name (that
1147 is, the argument given to system calls such as @code{open}).
1148 @end deftypevr
1150 @cindex limits, pipe buffer size
1151 @comment limits.h
1152 @comment POSIX.1
1153 @deftypevr Macro int PIPE_BUF
1154 The uniform system limit (if any) for the number of bytes that can be
1155 written atomically to a pipe.  If multiple processes are writing to the
1156 same pipe simultaneously, output from different processes might be
1157 interleaved in chunks of this size.  @xref{Pipes and FIFOs}.
1158 @end deftypevr
1160 These are alternative macro names for some of the same information.
1162 @comment dirent.h
1163 @comment BSD
1164 @deftypevr Macro int MAXNAMLEN
1165 This is the BSD name for @code{NAME_MAX}.  It is defined in
1166 @file{dirent.h}.
1167 @end deftypevr
1169 @comment stdio.h
1170 @comment ISO
1171 @deftypevr Macro int FILENAME_MAX
1172 The value of this macro is an integer constant expression that
1173 represents the maximum length of a file name string.  It is defined in
1174 @file{stdio.h}.
1176 Unlike @code{PATH_MAX}, this macro is defined even if there is no actual
1177 limit imposed.  In such a case, its value is typically a very large
1178 number.  @strong{This is always the case on the GNU system.}
1180 @strong{Usage Note:} Don't use @code{FILENAME_MAX} as the size of an
1181 array in which to store a file name!  You can't possibly make an array
1182 that big!  Use dynamic allocation (@pxref{Memory Allocation}) instead.
1183 @end deftypevr
1185 @node Options for Files
1186 @section Optional Features in File Support
1188 POSIX defines certain system-specific options in the system calls for
1189 operating on files.  Some systems support these options and others do
1190 not.  Since these options are provided in the kernel, not in the
1191 library, simply using the GNU C library does not guarantee any of these
1192 features is supported; it depends on the system you are using.  They can
1193 also vary between file systems on a single machine.
1195 @pindex unistd.h
1196 This section describes the macros you can test to determine whether a
1197 particular option is supported on your machine.  If a given macro is
1198 defined in @file{unistd.h}, then its value says whether the
1199 corresponding feature is supported.  (A value of @code{-1} indicates no;
1200 any other value indicates yes.)  If the macro is undefined, it means
1201 particular files may or may not support the feature.
1203 Since all the machines that support the GNU C library also support NFS,
1204 one can never make a general statement about whether all file systems
1205 support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC}
1206 features.  So these names are never defined as macros in the GNU C
1207 library.
1209 @comment unistd.h
1210 @comment POSIX.1
1211 @deftypevr Macro int _POSIX_CHOWN_RESTRICTED
1212 If this option is in effect, the @code{chown} function is restricted so
1213 that the only changes permitted to nonprivileged processes is to change
1214 the group owner of a file to either be the effective group ID of the
1215 process, or one of its supplementary group IDs.  @xref{File Owner}.
1216 @end deftypevr
1218 @comment unistd.h
1219 @comment POSIX.1
1220 @deftypevr Macro int _POSIX_NO_TRUNC
1221 If this option is in effect, file name components longer than
1222 @code{NAME_MAX} generate an @code{ENAMETOOLONG} error.  Otherwise, file
1223 name components that are too long are silently truncated.
1224 @end deftypevr
1226 @comment unistd.h
1227 @comment POSIX.1
1228 @deftypevr Macro {unsigned char} _POSIX_VDISABLE
1229 This option is only meaningful for files that are terminal devices.
1230 If it is enabled, then handling for special control characters can
1231 be disabled individually.  @xref{Special Characters}.
1232 @end deftypevr
1234 @pindex unistd.h
1235 If one of these macros is undefined, that means that the option might be
1236 in effect for some files and not for others.  To inquire about a
1237 particular file, call @code{pathconf} or @code{fpathconf}.
1238 @xref{Pathconf}.
1240 @node File Minimums
1241 @section Minimum Values for File System Limits
1243 Here are the names for the POSIX minimum upper bounds for some of the
1244 above parameters.  The significance of these values is that you can
1245 safely push to these limits without checking whether the particular
1246 system you are using can go that far.  In most cases GNU systems do not
1247 have these strict limitations.  The actual limit should be requested if
1248 necessary.
1250 @table @code
1251 @comment limits.h
1252 @comment POSIX.1
1253 @item _POSIX_LINK_MAX
1254 The most restrictive limit permitted by POSIX for the maximum value of a
1255 file's link count.  The value of this constant is @code{8}; thus, you
1256 can always make up to eight names for a file without running into a
1257 system limit.
1259 @comment limits.h
1260 @comment POSIX.1
1261 @item _POSIX_MAX_CANON
1262 The most restrictive limit permitted by POSIX for the maximum number of
1263 bytes in a canonical input line from a terminal device.  The value of
1264 this constant is @code{255}.
1266 @comment limits.h
1267 @comment POSIX.1
1268 @item _POSIX_MAX_INPUT
1269 The most restrictive limit permitted by POSIX for the maximum number of
1270 bytes in a terminal device input queue (or typeahead buffer).
1271 @xref{Input Modes}.  The value of this constant is @code{255}.
1273 @comment limits.h
1274 @comment POSIX.1
1275 @item _POSIX_NAME_MAX
1276 The most restrictive limit permitted by POSIX for the maximum number of
1277 bytes in a file name component.  The value of this constant is
1278 @code{14}.
1280 @comment limits.h
1281 @comment POSIX.1
1282 @item _POSIX_PATH_MAX
1283 The most restrictive limit permitted by POSIX for the maximum number of
1284 bytes in a file name.  The value of this constant is @code{255}.
1286 @comment limits.h
1287 @comment POSIX.1
1288 @item _POSIX_PIPE_BUF
1289 The most restrictive limit permitted by POSIX for the maximum number of
1290 bytes that can be written atomically to a pipe.  The value of this
1291 constant is @code{512}.
1292 @end table
1294 @node Pathconf
1295 @section Using @code{pathconf}
1297 When your machine allows different files to have different values for a
1298 file system parameter, you can use the functions in this section to find
1299 out the value that applies to any particular file.
1301 These functions and the associated constants for the @var{parameter}
1302 argument are declared in the header file @file{unistd.h}.
1304 @comment unistd.h
1305 @comment POSIX.1
1306 @deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})
1307 This function is used to inquire about the limits that apply to
1308 the file named @var{filename}.
1310 The @var{parameter} argument should be one of the @samp{_PC_} constants
1311 listed below.
1313 The normal return value from @code{pathconf} is the value you requested.
1314 A value of @code{-1} is returned both if the implementation does not
1315 impose a limit, and in case of an error.  In the former case,
1316 @code{errno} is not set, while in the latter case, @code{errno} is set
1317 to indicate the cause of the problem.  So the only way to use this
1318 function robustly is to store @code{0} into @code{errno} just before
1319 calling it.
1321 Besides the usual file name errors (@pxref{File Name Errors}),
1322 the following error condition is defined for this function:
1324 @table @code
1325 @item EINVAL
1326 The value of @var{parameter} is invalid, or the implementation doesn't
1327 support the @var{parameter} for the specific file.
1328 @end table
1329 @end deftypefun
1331 @comment unistd.h
1332 @comment POSIX.1
1333 @deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})
1334 This is just like @code{pathconf} except that an open file descriptor
1335 is used to specify the file for which information is requested, instead
1336 of a file name.
1338 The following @code{errno} error conditions are defined for this function:
1340 @table @code
1341 @item EBADF
1342 The @var{filedes} argument is not a valid file descriptor.
1344 @item EINVAL
1345 The value of @var{parameter} is invalid, or the implementation doesn't
1346 support the @var{parameter} for the specific file.
1347 @end table
1348 @end deftypefun
1350 Here are the symbolic constants that you can use as the @var{parameter}
1351 argument to @code{pathconf} and @code{fpathconf}.  The values are all
1352 integer constants.
1354 @table @code
1355 @comment unistd.h
1356 @comment POSIX.1
1357 @item _PC_LINK_MAX
1358 Inquire about the value of @code{LINK_MAX}.
1360 @comment unistd.h
1361 @comment POSIX.1
1362 @item _PC_MAX_CANON
1363 Inquire about the value of @code{MAX_CANON}.
1365 @comment unistd.h
1366 @comment POSIX.1
1367 @item _PC_MAX_INPUT
1368 Inquire about the value of @code{MAX_INPUT}.
1370 @comment unistd.h
1371 @comment POSIX.1
1372 @item _PC_NAME_MAX
1373 Inquire about the value of @code{NAME_MAX}.
1375 @comment unistd.h
1376 @comment POSIX.1
1377 @item _PC_PATH_MAX
1378 Inquire about the value of @code{PATH_MAX}.
1380 @comment unistd.h
1381 @comment POSIX.1
1382 @item _PC_PIPE_BUF
1383 Inquire about the value of @code{PIPE_BUF}.
1385 @comment unistd.h
1386 @comment POSIX.1
1387 @item _PC_CHOWN_RESTRICTED
1388 Inquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.
1390 @comment unistd.h
1391 @comment POSIX.1
1392 @item _PC_NO_TRUNC
1393 Inquire about the value of @code{_POSIX_NO_TRUNC}.
1395 @comment unistd.h
1396 @comment POSIX.1
1397 @item _PC_VDISABLE
1398 Inquire about the value of @code{_POSIX_VDISABLE}.
1400 @comment unistd.h
1401 @comment POSIX.1
1402 @item _PC_SYNC_IO
1403 Inquire about the value of @code{_POSIX_SYNC_IO}.
1405 @comment unistd.h
1406 @comment POSIX.1
1407 @item _PC_ASYNC_IO
1408 Inquire about the value of @code{_POSIX_ASYNC_IO}.
1410 @comment unistd.h
1411 @comment POSIX.1
1412 @item _PC_PRIO_IO
1413 Inquire about the value of @code{_POSIX_PRIO_IO}.
1415 @comment unistd.h
1416 @comment POSIX.1g
1417 @item _PC_SOCK_MAXBUF
1418 Inquire about the value of @code{_POSIX_PIPE_BUF}.
1419 @end table
1421 @node Utility Limits
1422 @section Utility Program Capacity Limits
1424 The POSIX.2 standard specifies certain system limits that you can access
1425 through @code{sysconf} that apply to utility behavior rather than the
1426 behavior of the library or the operating system.
1428 The GNU C library defines macros for these limits, and @code{sysconf}
1429 returns values for them if you ask; but these values convey no
1430 meaningful information.  They are simply the smallest values that
1431 POSIX.2 permits.
1433 @comment limits.h
1434 @comment POSIX.2
1435 @deftypevr Macro int BC_BASE_MAX
1436 The largest value of @code{obase} that the @code{bc} utility is
1437 guaranteed to support.
1438 @end deftypevr
1440 @comment limits.h
1441 @comment POSIX.2
1442 @deftypevr Macro int BC_SCALE_MAX
1443 The largest value of @code{scale} that the @code{bc} utility is
1444 guaranteed to support.
1445 @end deftypevr
1447 @comment limits.h
1448 @comment POSIX.2
1449 @deftypevr Macro int BC_DIM_MAX
1450 The largest number of elements in one array that the @code{bc} utility
1451 is guaranteed to support.
1452 @end deftypevr
1454 @comment limits.h
1455 @comment POSIX.2
1456 @deftypevr Macro int BC_STRING_MAX
1457 The largest number of characters in one string constant that the
1458 @code{bc} utility is guaranteed to support.
1459 @end deftypevr
1461 @comment limits.h
1462 @comment POSIX.2
1463 @deftypevr Macro int BC_DIM_MAX
1464 The largest number of elements in one array that the @code{bc} utility
1465 is guaranteed to support.
1466 @end deftypevr
1468 @comment limits.h
1469 @comment POSIX.2
1470 @deftypevr Macro int COLL_WEIGHTS_MAX
1471 The largest number of weights that can necessarily be used in defining
1472 the collating sequence for a locale.
1473 @end deftypevr
1475 @comment limits.h
1476 @comment POSIX.2
1477 @deftypevr Macro int EXPR_NEST_MAX
1478 The maximum number of expressions that can be nested within parenthesis
1479 by the @code{expr} utility.
1480 @end deftypevr
1482 @comment limits.h
1483 @comment POSIX.2
1484 @deftypevr Macro int LINE_MAX
1485 The largest text line that the text-oriented POSIX.2 utilities can
1486 support.  (If you are using the GNU versions of these utilities, then
1487 there is no actual limit except that imposed by the available virtual
1488 memory, but there is no way that the library can tell you this.)
1489 @end deftypevr
1491 @comment limits.h
1492 @comment POSIX.2
1493 @deftypevr Macro int EQUIV_CLASS_MAX
1494 The maximum number of weights that can be assigned to an entry of the
1495 @code{LC_COLLATE} category @samp{order} keyword in a locale definition.
1496 The GNU C library does not presently support locale definitions.
1497 @end deftypevr
1499 @node Utility Minimums
1500 @section Minimum Values for Utility Limits
1502 @table @code
1503 @comment limits.h
1504 @comment POSIX.2
1505 @item _POSIX2_BC_BASE_MAX
1506 The most restrictive limit permitted by POSIX.2 for the maximum value of
1507 @code{obase} in the @code{bc} utility.  Its value is @code{99}.
1509 @comment limits.h
1510 @comment POSIX.2
1511 @item _POSIX2_BC_DIM_MAX
1512 The most restrictive limit permitted by POSIX.2 for the maximum size of
1513 an array in the @code{bc} utility.  Its value is @code{2048}.
1515 @comment limits.h
1516 @comment POSIX.2
1517 @item _POSIX2_BC_SCALE_MAX
1518 The most restrictive limit permitted by POSIX.2 for the maximum value of
1519 @code{scale} in the @code{bc} utility.  Its value is @code{99}.
1521 @comment limits.h
1522 @comment POSIX.2
1523 @item _POSIX2_BC_STRING_MAX
1524 The most restrictive limit permitted by POSIX.2 for the maximum size of
1525 a string constant in the @code{bc} utility.  Its value is @code{1000}.
1527 @comment limits.h
1528 @comment POSIX.2
1529 @item _POSIX2_COLL_WEIGHTS_MAX
1530 The most restrictive limit permitted by POSIX.2 for the maximum number
1531 of weights that can necessarily be used in defining the collating
1532 sequence for a locale.  Its value is @code{2}.
1534 @comment limits.h
1535 @comment POSIX.2
1536 @item _POSIX2_EXPR_NEST_MAX
1537 The most restrictive limit permitted by POSIX.2 for the maximum number
1538 of expressions nested within parenthesis when using the @code{expr} utility.
1539 Its value is @code{32}.
1541 @comment limits.h
1542 @comment POSIX.2
1543 @item _POSIX2_LINE_MAX
1544 The most restrictive limit permitted by POSIX.2 for the maximum size of
1545 a text line that the text utilities can handle.  Its value is
1546 @code{2048}.
1548 @comment limits.h
1549 @comment POSIX.2
1550 @item _POSIX2_EQUIV_CLASS_MAX
1551 The most restrictive limit permitted by POSIX.2 for the maximum number
1552 of weights that can be assigned to an entry of the @code{LC_COLLATE}
1553 category @samp{order} keyword in a locale definition.  Its value is
1554 @code{2}.  The GNU C library does not presently support locale
1555 definitions.
1556 @end table
1558 @node String Parameters
1559 @section String-Valued Parameters
1561 POSIX.2 defines a way to get string-valued parameters from the operating
1562 system with the function @code{confstr}:
1564 @comment unistd.h
1565 @comment POSIX.2
1566 @deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})
1567 This function reads the value of a string-valued system parameter,
1568 storing the string into @var{len} bytes of memory space starting at
1569 @var{buf}.  The @var{parameter} argument should be one of the
1570 @samp{_CS_} symbols listed below.
1572 The normal return value from @code{confstr} is the length of the string
1573 value that you asked for.  If you supply a null pointer for @var{buf},
1574 then @code{confstr} does not try to store the string; it just returns
1575 its length.  A value of @code{0} indicates an error.
1577 If the string you asked for is too long for the buffer (that is, longer
1578 than @code{@var{len} - 1}), then @code{confstr} stores just that much
1579 (leaving room for the terminating null character).  You can tell that
1580 this has happened because @code{confstr} returns a value greater than or
1581 equal to @var{len}.
1583 The following @code{errno} error conditions are defined for this function:
1585 @table @code
1586 @item EINVAL
1587 The value of the @var{parameter} is invalid.
1588 @end table
1589 @end deftypefun
1591 Currently there is just one parameter you can read with @code{confstr}:
1593 @table @code
1594 @comment unistd.h
1595 @comment POSIX.2
1596 @item _CS_PATH
1597 This parameter's value is the recommended default path for searching for
1598 executable files.  This is the path that a user has by default just
1599 after logging in.
1601 @comment unistd.h
1602 @comment Unix98
1603 @item _CS_LFS_CFLAGS
1604 The returned string specifies which additionals flags must be given to
1605 the C compiler if a source is compiled using the
1606 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1608 @comment unistd.h
1609 @comment Unix98
1610 @item _CS_LFS_LDFLAGS
1611 The returned string specifies which additionals flags must be given to
1612 the linker if a source is compiled using the
1613 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1615 @comment unistd.h
1616 @comment Unix98
1617 @item _CS_LFS_LIBS
1618 The returned string specifies which additionals libraries must be linked
1619 to the application if a source is compiled using the
1620 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1622 @comment unistd.h
1623 @comment Unix98
1624 @item _CS_LFS_LINTFLAGS
1625 The returned string specifies which additionals flags must be given to
1626 the the lint tool if a source is compiled using the
1627 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1629 @comment unistd.h
1630 @comment Unix98
1631 @item _CS_LFS64_CFLAGS
1632 The returned string specifies which additionals flags must be given to
1633 the C compiler if a source is compiled using the
1634 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1636 @comment unistd.h
1637 @comment Unix98
1638 @item _CS_LFS64_LDFLAGS
1639 The returned string specifies which additionals flags must be given to
1640 the linker if a source is compiled using the
1641 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1643 @comment unistd.h
1644 @comment Unix98
1645 @item _CS_LFS64_LIBS
1646 The returned string specifies which additionals libraries must be linked
1647 to the application if a source is compiled using the
1648 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1650 @comment unistd.h
1651 @comment Unix98
1652 @item _CS_LFS64_LINTFLAGS
1653 The returned string specifies which additionals flags must be given to
1654 the the lint tool if a source is compiled using the
1655 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1656 @end table
1658 The way to use @code{confstr} without any arbitrary limit on string size
1659 is to call it twice: first call it to get the length, allocate the
1660 buffer accordingly, and then call @code{confstr} again to fill the
1661 buffer, like this:
1663 @smallexample
1664 @group
1665 char *
1666 get_default_path (void)
1668   size_t len = confstr (_CS_PATH, NULL, 0);
1669   char *buffer = (char *) xmalloc (len);
1671   if (confstr (_CS_PATH, buf, len + 1) == 0)
1672     @{
1673       free (buffer);
1674       return NULL;
1675     @}
1677   return buffer;
1679 @end group
1680 @end smallexample