Update.
[glibc.git] / manual / conf.texi
blob34554bc35f4983a5cbb80d59fcad7f686abf0180
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 @c This table runs a bit wide.
319 @iftex
320 @indexfonts
321 @end iftex
322 @table @code
323 @comment unistd.h
324 @comment POSIX.1
325 @item _SC_ARG_MAX
326 Inquire about the parameter corresponding to @code{ARG_MAX}.
328 @comment unistd.h
329 @comment POSIX.1
330 @item _SC_CHILD_MAX
331 Inquire about the parameter corresponding to @code{CHILD_MAX}.
333 @comment unistd.h
334 @comment POSIX.1
335 @item _SC_OPEN_MAX
336 Inquire about the parameter corresponding to @code{OPEN_MAX}.
338 @comment unistd.h
339 @comment POSIX.1
340 @item _SC_STREAM_MAX
341 Inquire about the parameter corresponding to @code{STREAM_MAX}.
343 @comment unistd.h
344 @comment POSIX.1
345 @item _SC_TZNAME_MAX
346 Inquire about the parameter corresponding to @code{TZNAME_MAX}.
348 @comment unistd.h
349 @comment POSIX.1
350 @item _SC_NGROUPS_MAX
351 Inquire about the parameter corresponding to @code{NGROUPS_MAX}.
353 @comment unistd.h
354 @comment POSIX.1
355 @item _SC_JOB_CONTROL
356 Inquire about the parameter corresponding to @code{_POSIX_JOB_CONTROL}.
358 @comment unistd.h
359 @comment POSIX.1
360 @item _SC_SAVED_IDS
361 Inquire about the parameter corresponding to @code{_POSIX_SAVED_IDS}.
363 @comment unistd.h
364 @comment POSIX.1
365 @item _SC_VERSION
366 Inquire about the parameter corresponding to @code{_POSIX_VERSION}.
368 @comment unistd.h
369 @comment POSIX.1
370 @item _SC_CLK_TCK
371 Inquire about the parameter corresponding to @code{CLOCKS_PER_SEC};
372 @pxref{Basic CPU Time}.
374 @comment unistd.h
375 @comment GNU
376 @item _SC_CHARCLASS_NAME_MAX
377 Inquire about the parameter corresponding to maximal length allowed for
378 a character class name in an extended locale specification.  These
379 extensions are not yet standardized and so this option is not standardized
380 as well.
382 @comment unistdh.h
383 @comment POSIX.1
384 @item _SC_REALTIME_SIGNALS
385 Inquire about the parameter corresponding to @code{_POSIX_REALTIME_SIGNALS}.
387 @comment unistd.h
388 @comment POSIX.1
389 @item _SC_PRIORITY_SCHEDULING
390 Inquire about the parameter corresponding to @code{_POSIX_PRIORITY_SCHEDULING}.
392 @comment unistd.h
393 @comment POSIX.1
394 @item _SC_TIMERS
395 Inquire about the parameter corresponding to @code{_POSIX_TIMERS}.
397 @comment unistd.h
398 @comment POSIX.1
399 @item _SC_ASYNCHRONOUS_IO
400 Inquire about the parameter corresponding to @code{_POSIX_ASYNCHRONOUS_IO}.
402 @comment unistd.h
403 @comment POSIX.1
404 @item _SC_PRIORITIZED_IO
405 Inquire about the parameter corresponding to @code{_POSIX_PRIORITIZED_IO}.
407 @comment unistd.h
408 @comment POSIX.1
409 @item _SC_SYNCHRONIZED_IO
410 Inquire about the parameter corresponding to @code{_POSIX_SYNCHRONIZED_IO}.
412 @comment unistd.h
413 @comment POSIX.1
414 @item _SC_FSYNC
415 Inquire about the parameter corresponding to @code{_POSIX_FSYNC}.
417 @comment unistd.h
418 @comment POSIX.1
419 @item _SC_MAPPED_FILES
420 Inquire about the parameter corresponding to @code{_POSIX_MAPPED_FILES}.
422 @comment unistd.h
423 @comment POSIX.1
424 @item _SC_MEMLOCK
425 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK}.
427 @comment unistd.h
428 @comment POSIX.1
429 @item _SC_MEMLOCK_RANGE
430 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK_RANGE}.
432 @comment unistd.h
433 @comment POSIX.1
434 @item _SC_MEMORY_PROTECTION
435 Inquire about the parameter corresponding to @code{_POSIX_MEMORY_PROTECTION}.
437 @comment unistd.h
438 @comment POSIX.1
439 @item _SC_MESSAGE_PASSING
440 Inquire about the parameter corresponding to @code{_POSIX_MESSAGE_PASSING}.
442 @comment unistd.h
443 @comment POSIX.1
444 @item _SC_SEMAPHORES
445 Inquire about the parameter corresponding to @code{_POSIX_SEMAPHORES}.
447 @comment unistd.h
448 @comment POSIX.1
449 @item _SC_SHARED_MEMORY_OBJECTS
450 Inquire about the parameter corresponding to
451 @code{_POSIX_SHARED_MEMORY_OBJECTS}.
453 @comment unistd.h
454 @comment POSIX.1
455 @item _SC_AIO_LISTIO_MAX
456 Inquire about the parameter corresponding to @code{_POSIX_AIO_LISTIO_MAX}.
458 @comment unistd.h
459 @comment POSIX.1
460 @item _SC_AIO_MAX
461 Inquire about the parameter corresponding to @code{_POSIX_AIO_MAX}.
463 @comment unistd.h
464 @comment POSIX.1
465 @item _SC_AIO_PRIO_DELTA_MAX
466 Inquire the value by which a process can decrease its asynchronous I/O
467 priority level from its own scheduling priority.  This corresponds to the
468 run-time invariant value @code{AIO_PRIO_DELTA_MAX}.
470 @comment unistd.h
471 @comment POSIX.1
472 @item _SC_DELAYTIMER_MAX
473 Inquire about the parameter corresponding to @code{_POSIX_DELAYTIMER_MAX}.
475 @comment unistd.h
476 @comment POSIX.1
477 @item _SC_MQ_OPEN_MAX
478 Inquire about the parameter corresponding to @code{_POSIX_MQ_OPEN_MAX}.
480 @comment unistd.h
481 @comment POSIX.1
482 @item _SC_MQ_PRIO_MAX
483 Inquire about the parameter corresponding to @code{_POSIX_MQ_PRIO_MAX}.
485 @comment unistd.h
486 @comment POSIX.1
487 @item _SC_RTSIG_MAX
488 Inquire about the parameter corresponding to @code{_POSIX_RTSIG_MAX}.
490 @comment unistd.h
491 @comment POSIX.1
492 @item _SC_SEM_NSEMS_MAX
493 Inquire about the parameter corresponding to @code{_POSIX_SEM_NSEMS_MAX}.
495 @comment unistd.h
496 @comment POSIX.1
497 @item _SC_SEM_VALUE_MAX
498 Inquire about the parameter corresponding to @code{_POSIX_SEM_VALUE_MAX}.
500 @comment unistd.h
501 @comment POSIX.1
502 @item _SC_SIGQUEUE_MAX
503 Inquire about the parameter corresponding to @code{_POSIX_SIGQUEUE_MAX}.
505 @comment unistd.h
506 @comment POSIX.1
507 @item _SC_TIMER_MAX
508 Inquire about the parameter corresponding to @code{_POSIX_TIMER_MAX}.
510 @comment unistd.h
511 @comment POSIX.1g
512 @item _SC_PII
513 Inquire about the parameter corresponding to @code{_POSIX_PII}.
515 @comment unistd.h
516 @comment POSIX.1g
517 @item _SC_PII_XTI
518 Inquire about the parameter corresponding to @code{_POSIX_PII_XTI}.
520 @comment unistd.h
521 @comment POSIX.1g
522 @item _SC_PII_SOCKET
523 Inquire about the parameter corresponding to @code{_POSIX_PII_SOCKET}.
525 @comment unistd.h
526 @comment POSIX.1g
527 @item _SC_PII_INTERNET
528 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET}.
530 @comment unistd.h
531 @comment POSIX.1g
532 @item _SC_PII_OSI
533 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI}.
535 @comment unistd.h
536 @comment POSIX.1g
537 @item _SC_SELECT
538 Inquire about the parameter corresponding to @code{_POSIX_SELECT}.
540 @comment unistd.h
541 @comment POSIX.1g
542 @item _SC_UIO_MAXIOV
543 Inquire about the parameter corresponding to @code{_POSIX_UIO_MAXIOV}.
545 @comment unistd.h
546 @comment POSIX.1g
547 @item _SC_PII_INTERNET_STREAM
548 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_STREAM}.
550 @comment unistd.h
551 @comment POSIX.1g
552 @item _SC_PII_INTERNET_DGRAM
553 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_DGRAM}.
555 @comment unistd.h
556 @comment POSIX.1g
557 @item _SC_PII_OSI_COTS
558 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_COTS}.
560 @comment unistd.h
561 @comment POSIX.1g
562 @item _SC_PII_OSI_CLTS
563 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_CLTS}.
565 @comment unistd.h
566 @comment POSIX.1g
567 @item _SC_PII_OSI_M
568 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_M}.
570 @comment unistd.h
571 @comment POSIX.1g
572 @item _SC_T_IOV_MAX
573 Inquire the value of the value associated with the @code{T_IOV_MAX}
574 variable.
576 @comment unistd.h
577 @comment POSIX.1
578 @item _SC_THREADS
579 Inquire about the parameter corresponding to @code{_POSIX_THREADS}.
581 @comment unistd.h
582 @comment POSIX.1
583 @item _SC_THREAD_SAFE_FUNCTIONS
584 Inquire about the parameter corresponding to
585 @code{_POSIX_THREAD_SAFE_FUNCTIONS}.
587 @comment unistd.h
588 @comment POSIX.1
589 @item _SC_GETGR_R_SIZE_MAX
590 Inquire about the parameter corresponding to @code{_POSIX_GETGR_R_SIZE_MAX}.
592 @comment unistd.h
593 @comment POSIX.1
594 @item _SC_GETPW_R_SIZE_MAX
595 Inquire about the parameter corresponding to @code{_POSIX_GETPW_R_SIZE_MAX}.
597 @comment unistd.h
598 @comment POSIX.1
599 @item _SC_LOGIN_NAME_MAX
600 Inquire about the parameter corresponding to @code{_POSIX_LOGIN_NAME_MAX}.
602 @comment unistd.h
603 @comment POSIX.1
604 @item _SC_TTY_NAME_MAX
605 Inquire about the parameter corresponding to @code{_POSIX_TTY_NAME_MAX}.
607 @comment unistd.h
608 @comment POSIX.1
609 @item _SC_THREAD_DESTRUCTOR_ITERATIONS
610 Inquire about the parameter corresponding to
611 @code{_POSIX_THREAD_DESTRUCTOR_@*ITERATIONS}.
613 @comment unistd.h
614 @comment POSIX.1
615 @item _SC_THREAD_KEYS_MAX
616 Inquire about the parameter corresponding to @code{_POSIX_THREAD_KEYS_MAX}.
618 @comment unistd.h
619 @comment POSIX.1
620 @item _SC_THREAD_STACK_MIN
621 Inquire about the parameter corresponding to @code{_POSIX_THREAD_STACK_MIN}.
623 @comment unistd.h
624 @comment POSIX.1
625 @item _SC_THREAD_THREADS_MAX
626 Inquire about the parameter corresponding to @code{_POSIX_THREAD_THREADS_MAX}.
628 @comment unistd.h
629 @comment POSIX.1
630 @item _SC_THREAD_ATTR_STACKADDR
631 Inquire about the parameter corresponding to
632 @code{_POSIX_THREAD_ATTR_STACKADDR}.
634 @comment unistd.h
635 @comment POSIX.1
636 @item _SC_THREAD_ATTR_STACKSIZE
637 Inquire about the parameter corresponding to
638 @code{_POSIX_THREAD_ATTR_STACKSIZE}.
640 @comment unistd.h
641 @comment POSIX.1
642 @item _SC_THREAD_PRIORITY_SCHEDULING
643 Inquire about the parameter corresponding to
644 @code{_POSIX_THREAD_PRIORITY_SCHEDULING}.
646 @comment unistd.h
647 @comment POSIX.1
648 @item _SC_THREAD_PRIO_INHERIT
649 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_INHERIT}.
651 @comment unistd.h
652 @comment POSIX.1
653 @item _SC_THREAD_PRIO_PROTECT
654 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_PROTECT}.
656 @comment unistd.h
657 @comment POSIX.1
658 @item _SC_THREAD_PROCESS_SHARED
659 Inquire about the parameter corresponding to
660 @code{_POSIX_THREAD_PROCESS_SHARED}.
662 @comment unistd.h
663 @comment POSIX.2
664 @item _SC_2_C_DEV
665 Inquire about whether the system has the POSIX.2 C compiler command,
666 @code{c89}.
668 @comment unistd.h
669 @comment POSIX.2
670 @item _SC_2_FORT_DEV
671 Inquire about whether the system has the POSIX.2 Fortran compiler
672 command, @code{fort77}.
674 @comment unistd.h
675 @comment POSIX.2
676 @item _SC_2_FORT_RUN
677 Inquire about whether the system has the POSIX.2 @code{asa} command to
678 interpret Fortran carriage control.
680 @comment unistd.h
681 @comment POSIX.2
682 @item _SC_2_LOCALEDEF
683 Inquire about whether the system has the POSIX.2 @code{localedef}
684 command.
686 @comment unistd.h
687 @comment POSIX.2
688 @item _SC_2_SW_DEV
689 Inquire about whether the system has the POSIX.2 commands @code{ar},
690 @code{make}, and @code{strip}.
692 @comment unistd.h
693 @comment POSIX.2
694 @item _SC_BC_BASE_MAX
695 Inquire about the maximum value of @code{obase} in the @code{bc}
696 utility.
698 @comment unistd.h
699 @comment POSIX.2
700 @item _SC_BC_DIM_MAX
701 Inquire about the maximum size of an array in the @code{bc}
702 utility.
704 @comment unistd.h
705 @comment POSIX.2
706 @item _SC_BC_SCALE_MAX
707 Inquire about the maximum value of @code{scale} in the @code{bc}
708 utility.
710 @comment unistd.h
711 @comment POSIX.2
712 @item _SC_BC_STRING_MAX
713 Inquire about the maximum size of a string constant in the
714 @code{bc} utility.
716 @comment unistd.h
717 @comment POSIX.2
718 @item _SC_COLL_WEIGHTS_MAX
719 Inquire about the maximum number of weights that can necessarily
720 be used in defining the collating sequence for a locale.
722 @comment unistd.h
723 @comment POSIX.2
724 @item _SC_EXPR_NEST_MAX
725 Inquire about the maximum number of expressions nested within
726 parentheses when using the @code{expr} utility.
728 @comment unistd.h
729 @comment POSIX.2
730 @item _SC_LINE_MAX
731 Inquire about the maximum size of a text line that the POSIX.2 text
732 utilities can handle.
734 @comment unistd.h
735 @comment POSIX.2
736 @item _SC_EQUIV_CLASS_MAX
737 Inquire about the maximum number of weights that can be assigned to an
738 entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale
739 definition.  The GNU C library does not presently support locale
740 definitions.
742 @comment unistd.h
743 @comment POSIX.2
744 @item _SC_VERSION
745 Inquire about the version number of POSIX.1 that the library and kernel
746 support.
748 @comment unistd.h
749 @comment POSIX.2
750 @item _SC_2_VERSION
751 Inquire about the version number of POSIX.2 that the system utilities
752 support.
754 @comment unistd.h
755 @comment GNU
756 @item _SC_PAGESIZE
757 Inquire about the virtual memory page size of the machine.
758 @code{getpagesize} returns the same value.
759 @c @xref{XXX getpagesize}. !!! ???
761 @comment unistd.h
762 @comment GNU
763 @item _SC_NPROCESSORS_CONF
764 Inquire about number of configured processors.
766 @comment unistd.h
767 @comment GNU
768 @item _SC_NPROCESSORS_ONLN
769 Inquire about number of processors online.
771 @comment unistd.h
772 @comment GNU
773 @item _SC_PHYS_PAGES
774 Inquire about number of physical pages in the system.
776 @comment unistd.h
777 @comment GNU
778 @item _SC_AVPHYS_PAGES
779 Inquire about number of available physical pages in the system.
781 @comment unistd.h
782 @comment GNU
783 @item _SC_ATEXIT_MAX
784 Inquire about number of functions which can be registered as termination
785 functions for @code{atexit}; @pxref{Cleanups on Exit}.
787 @comment unistd.h
788 @comment X/Open
789 @item _SC_XOPEN_VERSION
790 Inquire about the parameter corresponding to @code{_XOPEN_VERSION}.
792 @comment unistd.h
793 @comment X/Open
794 @item _SC_XOPEN_XCU_VERSION
795 Inquire about the parameter corresponding to @code{_XOPEN_XCU_VERSION}.
797 @comment unistd.h
798 @comment X/Open
799 @item _SC_XOPEN_UNIX
800 Inquire about the parameter corresponding to @code{_XOPEN_UNIX}.
802 @comment unistd.h
803 @comment X/Open
804 @item _SC_XOPEN_CRYPT
805 Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
807 @comment unistd.h
808 @comment X/Open
809 @item _SC_XOPEN_ENH_I18N
810 Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
812 @comment unistd.h
813 @comment X/Open
814 @item _SC_XOPEN_SHM
815 Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
817 @comment unistd.h
818 @comment X/Open
819 @item _SC_XOPEN_XPG2
820 Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
822 @comment unistd.h
823 @comment X/Open
824 @item _SC_XOPEN_XPG3
825 Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
827 @comment unistd.h
828 @comment X/Open
829 @item _SC_XOPEN_XPG4
830 Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
832 @comment unistd.h
833 @comment X/Open
834 @item _SC_CHAR_BIT
835 Inquire about number of bits in a variable of type @code{char}.
837 @comment unistd.h
838 @comment X/Open
839 @item _SC_CHAR_MAX
840 Inquire about maximum value which can be stored in a variable of type
841 @code{char}.
843 @comment unistd.h
844 @comment X/Open
845 @item _SC_CHAR_MIN
846 Inquire about minimum value which can be stored in a variable of type
847 @code{char}.
849 @comment unistd.h
850 @comment X/Open
851 @item _SC_INT_MAX
852 Inquire about maximum value which can be stored in a variable of type
853 @code{int}.
855 @comment unistd.h
856 @comment X/Open
857 @item _SC_INT_MIN
858 Inquire about minimum value which can be stored in a variable of type
859 @code{int}.
861 @comment unistd.h
862 @comment X/Open
863 @item _SC_LONG_BIT
864 Inquire about number of bits in a variable of type @code{long int}.
866 @comment unistd.h
867 @comment X/Open
868 @item _SC_WORD_BIT
869 Inquire about number of bits in a variable of a register word.
871 @comment unistd.h
872 @comment X/Open
873 @item _SC_MB_LEN_MAX
874 Inquire the maximum length of a multi-byte representation of a wide
875 character value.
877 @comment unistd.h
878 @comment X/Open
879 @item _SC_NZERO
880 Inquire value used to internally represent the zero priority level for
881 the process execution.
883 @comment unistd.h
884 @comment X/Open
885 @item SC_SSIZE_MAX
886 Inquire about maximum value which can be stored in a variable of type
887 @code{ssize_t}.
889 @comment unistd.h
890 @comment X/Open
891 @item _SC_SCHAR_MAX
892 Inquire about maximum value which can be stored in a variable of type
893 @code{signed char}.
895 @comment unistd.h
896 @comment X/Open
897 @item _SC_SCHAR_MIN
898 Inquire about minimum value which can be stored in a variable of type
899 @code{signed char}.
901 @comment unistd.h
902 @comment X/Open
903 @item _SC_SHRT_MAX
904 Inquire about maximum value which can be stored in a variable of type
905 @code{short int}.
907 @comment unistd.h
908 @comment X/Open
909 @item _SC_SHRT_MIN
910 Inquire about minimum value which can be stored in a variable of type
911 @code{short int}.
913 @comment unistd.h
914 @comment X/Open
915 @item _SC_UCHAR_MAX
916 Inquire about maximum value which can be stored in a variable of type
917 @code{unsigned char}.
919 @comment unistd.h
920 @comment X/Open
921 @item _SC_UINT_MAX
922 Inquire about maximum value which can be stored in a variable of type
923 @code{unsigned int}.
925 @comment unistd.h
926 @comment X/Open
927 @item _SC_ULONG_MAX
928 Inquire about maximum value which can be stored in a variable of type
929 @code{unsigned long int}.
931 @comment unistd.h
932 @comment X/Open
933 @item _SC_USHRT_MAX
934 Inquire about maximum value which can be stored in a variable of type
935 @code{unsigned short int}.
937 @comment unistd.h
938 @comment X/Open
939 @item _SC_NL_ARGMAX
940 Inquire about the parameter corresponding to @code{NL_ARGMAX}.
942 @comment unistd.h
943 @comment X/Open
944 @item _SC_NL_LANGMAX
945 Inquire about the parameter corresponding to @code{NL_LANGMAX}.
947 @comment unistd.h
948 @comment X/Open
949 @item _SC_NL_MSGMAX
950 Inquire about the parameter corresponding to @code{NL_MSGMAX}.
952 @comment unistd.h
953 @comment X/Open
954 @item _SC_NL_NMAX
955 Inquire about  the parameter corresponding to @code{NL_NMAX}.
957 @comment unistd.h
958 @comment X/Open
959 @item _SC_NL_SETMAX
960 Inquire about  the parameter corresponding to @code{NL_SETMAX}.
962 @comment unistd.h
963 @comment X/Open
964 @item _SC_NL_TEXTMAX
965 Inquire about  the parameter corresponding to @code{NL_TEXTMAX}.
966 @end table
967 @iftex
968 @textfonts
969 @end iftex
971 @node Examples of Sysconf
972 @subsection Examples of @code{sysconf}
974 We recommend that you first test for a macro definition for the
975 parameter you are interested in, and call @code{sysconf} only if the
976 macro is not defined.  For example, here is how to test whether job
977 control is supported:
979 @smallexample
980 @group
982 have_job_control (void)
984 #ifdef _POSIX_JOB_CONTROL
985   return 1;
986 #else
987   int value = sysconf (_SC_JOB_CONTROL);
988   if (value < 0)
989     /* @r{If the system is that badly wedged,}
990        @r{there's no use trying to go on.}  */
991     fatal (strerror (errno));
992   return value;
993 #endif
995 @end group
996 @end smallexample
998 Here is how to get the value of a numeric limit:
1000 @smallexample
1002 get_child_max ()
1004 #ifdef CHILD_MAX
1005   return CHILD_MAX;
1006 #else
1007   int value = sysconf (_SC_CHILD_MAX);
1008   if (value < 0)
1009     fatal (strerror (errno));
1010   return value;
1011 #endif
1013 @end smallexample
1015 @node Minimums
1016 @section Minimum Values for General Capacity Limits
1018 Here are the names for the POSIX minimum upper bounds for the system
1019 limit parameters.  The significance of these values is that you can
1020 safely push to these limits without checking whether the particular
1021 system you are using can go that far.
1023 @table @code
1024 @comment limits.h
1025 @comment POSIX.1
1026 @item _POSIX_AIO_LISTIO_MAX
1027 The most restrictive limit permitted by POSIX for the maximum number of
1028 I/O operations that can be specified in a list I/O call.  The value of
1029 this constant is @code{2}; thus you can add up to two new entries
1030 of the list of outstandard operations.
1032 @comment limits.h
1033 @comment POSIX.1
1034 @item _POSIX_AIO_MAX
1035 The most restrictive limit permitted by POSIX for the maximum number of
1036 outstanding asynchronous I/O operations.  The value of this constant is
1037 @code{1}.  So you cannot expect that you can issue more than one
1038 operation and immediately continue with the normal work, receiving the
1039 notifications asynchronously.
1041 @comment limits.h
1042 @comment POSIX.1
1043 @item _POSIX_ARG_MAX
1044 The value of this macro is the most restrictive limit permitted by POSIX
1045 for the maximum combined length of the @var{argv} and @var{environ}
1046 arguments that can be passed to the @code{exec} functions.
1047 Its value is @code{4096}.
1049 @comment limits.h
1050 @comment POSIX.1
1051 @item _POSIX_CHILD_MAX
1052 The value of this macro is the most restrictive limit permitted by POSIX
1053 for the maximum number of simultaneous processes per real user ID.  Its
1054 value is @code{6}.
1056 @comment limits.h
1057 @comment POSIX.1
1058 @item _POSIX_NGROUPS_MAX
1059 The value of this macro is the most restrictive limit permitted by POSIX
1060 for the maximum number of supplementary group IDs per process.  Its
1061 value is @code{0}.
1063 @comment limits.h
1064 @comment POSIX.1
1065 @item _POSIX_OPEN_MAX
1066 The value of this macro is the most restrictive limit permitted by POSIX
1067 for the maximum number of files that a single process can have open
1068 simultaneously.  Its value is @code{16}.
1070 @comment limits.h
1071 @comment POSIX.1
1072 @item _POSIX_SSIZE_MAX
1073 The value of this macro is the most restrictive limit permitted by POSIX
1074 for the maximum value that can be stored in an object of type
1075 @code{ssize_t}.  Its value is @code{32767}.
1077 @comment limits.h
1078 @comment POSIX.1
1079 @item _POSIX_STREAM_MAX
1080 The value of this macro is the most restrictive limit permitted by POSIX
1081 for the maximum number of streams that a single process can have open
1082 simultaneously.  Its value is @code{8}.
1084 @comment limits.h
1085 @comment POSIX.1
1086 @item _POSIX_TZNAME_MAX
1087 The value of this macro is the most restrictive limit permitted by POSIX
1088 for the maximum length of a time zone name.  Its value is @code{3}.
1090 @comment limits.h
1091 @comment POSIX.2
1092 @item _POSIX2_RE_DUP_MAX
1093 The value of this macro is the most restrictive limit permitted by POSIX
1094 for the numbers used in the @samp{\@{@var{min},@var{max}\@}} construct
1095 in a regular expression.  Its value is @code{255}.
1096 @end table
1098 @node Limits for Files
1099 @section Limits on File System Capacity
1101 The POSIX.1 standard specifies a number of parameters that describe the
1102 limitations of the file system.  It's possible for the system to have a
1103 fixed, uniform limit for a parameter, but this isn't the usual case.  On
1104 most systems, it's possible for different file systems (and, for some
1105 parameters, even different files) to have different maximum limits.  For
1106 example, this is very likely if you use NFS to mount some of the file
1107 systems from other machines.
1109 @pindex limits.h
1110 Each of the following macros is defined in @file{limits.h} only if the
1111 system has a fixed, uniform limit for the parameter in question.  If the
1112 system allows different file systems or files to have different limits,
1113 then the macro is undefined; use @code{pathconf} or @code{fpathconf} to
1114 find out the limit that applies to a particular file.  @xref{Pathconf}.
1116 Each parameter also has another macro, with a name starting with
1117 @samp{_POSIX}, which gives the lowest value that the limit is allowed to
1118 have on @emph{any} POSIX system.  @xref{File Minimums}.
1120 @cindex limits, link count of files
1121 @comment limits.h
1122 @comment POSIX.1
1123 @deftypevr Macro int LINK_MAX
1124 The uniform system limit (if any) for the number of names for a given
1125 file.  @xref{Hard Links}.
1126 @end deftypevr
1128 @cindex limits, terminal input queue
1129 @comment limits.h
1130 @comment POSIX.1
1131 @deftypevr Macro int MAX_CANON
1132 The uniform system limit (if any) for the amount of text in a line of
1133 input when input editing is enabled.  @xref{Canonical or Not}.
1134 @end deftypevr
1136 @comment limits.h
1137 @comment POSIX.1
1138 @deftypevr Macro int MAX_INPUT
1139 The uniform system limit (if any) for the total number of characters
1140 typed ahead as input.  @xref{I/O Queues}.
1141 @end deftypevr
1143 @cindex limits, file name length
1144 @comment limits.h
1145 @comment POSIX.1
1146 @deftypevr Macro int NAME_MAX
1147 The uniform system limit (if any) for the length of a file name component.
1148 @end deftypevr
1150 @comment limits.h
1151 @comment POSIX.1
1152 @deftypevr Macro int PATH_MAX
1153 The uniform system limit (if any) for the length of an entire file name (that
1154 is, the argument given to system calls such as @code{open}).
1155 @end deftypevr
1157 @cindex limits, pipe buffer size
1158 @comment limits.h
1159 @comment POSIX.1
1160 @deftypevr Macro int PIPE_BUF
1161 The uniform system limit (if any) for the number of bytes that can be
1162 written atomically to a pipe.  If multiple processes are writing to the
1163 same pipe simultaneously, output from different processes might be
1164 interleaved in chunks of this size.  @xref{Pipes and FIFOs}.
1165 @end deftypevr
1167 These are alternative macro names for some of the same information.
1169 @comment dirent.h
1170 @comment BSD
1171 @deftypevr Macro int MAXNAMLEN
1172 This is the BSD name for @code{NAME_MAX}.  It is defined in
1173 @file{dirent.h}.
1174 @end deftypevr
1176 @comment stdio.h
1177 @comment ISO
1178 @deftypevr Macro int FILENAME_MAX
1179 The value of this macro is an integer constant expression that
1180 represents the maximum length of a file name string.  It is defined in
1181 @file{stdio.h}.
1183 Unlike @code{PATH_MAX}, this macro is defined even if there is no actual
1184 limit imposed.  In such a case, its value is typically a very large
1185 number.  @strong{This is always the case on the GNU system.}
1187 @strong{Usage Note:} Don't use @code{FILENAME_MAX} as the size of an
1188 array in which to store a file name!  You can't possibly make an array
1189 that big!  Use dynamic allocation (@pxref{Memory Allocation}) instead.
1190 @end deftypevr
1192 @node Options for Files
1193 @section Optional Features in File Support
1195 POSIX defines certain system-specific options in the system calls for
1196 operating on files.  Some systems support these options and others do
1197 not.  Since these options are provided in the kernel, not in the
1198 library, simply using the GNU C library does not guarantee any of these
1199 features is supported; it depends on the system you are using.  They can
1200 also vary between file systems on a single machine.
1202 @pindex unistd.h
1203 This section describes the macros you can test to determine whether a
1204 particular option is supported on your machine.  If a given macro is
1205 defined in @file{unistd.h}, then its value says whether the
1206 corresponding feature is supported.  (A value of @code{-1} indicates no;
1207 any other value indicates yes.)  If the macro is undefined, it means
1208 particular files may or may not support the feature.
1210 Since all the machines that support the GNU C library also support NFS,
1211 one can never make a general statement about whether all file systems
1212 support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC}
1213 features.  So these names are never defined as macros in the GNU C
1214 library.
1216 @comment unistd.h
1217 @comment POSIX.1
1218 @deftypevr Macro int _POSIX_CHOWN_RESTRICTED
1219 If this option is in effect, the @code{chown} function is restricted so
1220 that the only changes permitted to nonprivileged processes is to change
1221 the group owner of a file to either be the effective group ID of the
1222 process, or one of its supplementary group IDs.  @xref{File Owner}.
1223 @end deftypevr
1225 @comment unistd.h
1226 @comment POSIX.1
1227 @deftypevr Macro int _POSIX_NO_TRUNC
1228 If this option is in effect, file name components longer than
1229 @code{NAME_MAX} generate an @code{ENAMETOOLONG} error.  Otherwise, file
1230 name components that are too long are silently truncated.
1231 @end deftypevr
1233 @comment unistd.h
1234 @comment POSIX.1
1235 @deftypevr Macro {unsigned char} _POSIX_VDISABLE
1236 This option is only meaningful for files that are terminal devices.
1237 If it is enabled, then handling for special control characters can
1238 be disabled individually.  @xref{Special Characters}.
1239 @end deftypevr
1241 @pindex unistd.h
1242 If one of these macros is undefined, that means that the option might be
1243 in effect for some files and not for others.  To inquire about a
1244 particular file, call @code{pathconf} or @code{fpathconf}.
1245 @xref{Pathconf}.
1247 @node File Minimums
1248 @section Minimum Values for File System Limits
1250 Here are the names for the POSIX minimum upper bounds for some of the
1251 above parameters.  The significance of these values is that you can
1252 safely push to these limits without checking whether the particular
1253 system you are using can go that far.  In most cases GNU systems do not
1254 have these strict limitations.  The actual limit should be requested if
1255 necessary.
1257 @table @code
1258 @comment limits.h
1259 @comment POSIX.1
1260 @item _POSIX_LINK_MAX
1261 The most restrictive limit permitted by POSIX for the maximum value of a
1262 file's link count.  The value of this constant is @code{8}; thus, you
1263 can always make up to eight names for a file without running into a
1264 system limit.
1266 @comment limits.h
1267 @comment POSIX.1
1268 @item _POSIX_MAX_CANON
1269 The most restrictive limit permitted by POSIX for the maximum number of
1270 bytes in a canonical input line from a terminal device.  The value of
1271 this constant is @code{255}.
1273 @comment limits.h
1274 @comment POSIX.1
1275 @item _POSIX_MAX_INPUT
1276 The most restrictive limit permitted by POSIX for the maximum number of
1277 bytes in a terminal device input queue (or typeahead buffer).
1278 @xref{Input Modes}.  The value of this constant is @code{255}.
1280 @comment limits.h
1281 @comment POSIX.1
1282 @item _POSIX_NAME_MAX
1283 The most restrictive limit permitted by POSIX for the maximum number of
1284 bytes in a file name component.  The value of this constant is
1285 @code{14}.
1287 @comment limits.h
1288 @comment POSIX.1
1289 @item _POSIX_PATH_MAX
1290 The most restrictive limit permitted by POSIX for the maximum number of
1291 bytes in a file name.  The value of this constant is @code{255}.
1293 @comment limits.h
1294 @comment POSIX.1
1295 @item _POSIX_PIPE_BUF
1296 The most restrictive limit permitted by POSIX for the maximum number of
1297 bytes that can be written atomically to a pipe.  The value of this
1298 constant is @code{512}.
1299 @end table
1301 @node Pathconf
1302 @section Using @code{pathconf}
1304 When your machine allows different files to have different values for a
1305 file system parameter, you can use the functions in this section to find
1306 out the value that applies to any particular file.
1308 These functions and the associated constants for the @var{parameter}
1309 argument are declared in the header file @file{unistd.h}.
1311 @comment unistd.h
1312 @comment POSIX.1
1313 @deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})
1314 This function is used to inquire about the limits that apply to
1315 the file named @var{filename}.
1317 The @var{parameter} argument should be one of the @samp{_PC_} constants
1318 listed below.
1320 The normal return value from @code{pathconf} is the value you requested.
1321 A value of @code{-1} is returned both if the implementation does not
1322 impose a limit, and in case of an error.  In the former case,
1323 @code{errno} is not set, while in the latter case, @code{errno} is set
1324 to indicate the cause of the problem.  So the only way to use this
1325 function robustly is to store @code{0} into @code{errno} just before
1326 calling it.
1328 Besides the usual file name errors (@pxref{File Name Errors}),
1329 the following error condition is defined for this function:
1331 @table @code
1332 @item EINVAL
1333 The value of @var{parameter} is invalid, or the implementation doesn't
1334 support the @var{parameter} for the specific file.
1335 @end table
1336 @end deftypefun
1338 @comment unistd.h
1339 @comment POSIX.1
1340 @deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})
1341 This is just like @code{pathconf} except that an open file descriptor
1342 is used to specify the file for which information is requested, instead
1343 of a file name.
1345 The following @code{errno} error conditions are defined for this function:
1347 @table @code
1348 @item EBADF
1349 The @var{filedes} argument is not a valid file descriptor.
1351 @item EINVAL
1352 The value of @var{parameter} is invalid, or the implementation doesn't
1353 support the @var{parameter} for the specific file.
1354 @end table
1355 @end deftypefun
1357 Here are the symbolic constants that you can use as the @var{parameter}
1358 argument to @code{pathconf} and @code{fpathconf}.  The values are all
1359 integer constants.
1361 @table @code
1362 @comment unistd.h
1363 @comment POSIX.1
1364 @item _PC_LINK_MAX
1365 Inquire about the value of @code{LINK_MAX}.
1367 @comment unistd.h
1368 @comment POSIX.1
1369 @item _PC_MAX_CANON
1370 Inquire about the value of @code{MAX_CANON}.
1372 @comment unistd.h
1373 @comment POSIX.1
1374 @item _PC_MAX_INPUT
1375 Inquire about the value of @code{MAX_INPUT}.
1377 @comment unistd.h
1378 @comment POSIX.1
1379 @item _PC_NAME_MAX
1380 Inquire about the value of @code{NAME_MAX}.
1382 @comment unistd.h
1383 @comment POSIX.1
1384 @item _PC_PATH_MAX
1385 Inquire about the value of @code{PATH_MAX}.
1387 @comment unistd.h
1388 @comment POSIX.1
1389 @item _PC_PIPE_BUF
1390 Inquire about the value of @code{PIPE_BUF}.
1392 @comment unistd.h
1393 @comment POSIX.1
1394 @item _PC_CHOWN_RESTRICTED
1395 Inquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.
1397 @comment unistd.h
1398 @comment POSIX.1
1399 @item _PC_NO_TRUNC
1400 Inquire about the value of @code{_POSIX_NO_TRUNC}.
1402 @comment unistd.h
1403 @comment POSIX.1
1404 @item _PC_VDISABLE
1405 Inquire about the value of @code{_POSIX_VDISABLE}.
1407 @comment unistd.h
1408 @comment POSIX.1
1409 @item _PC_SYNC_IO
1410 Inquire about the value of @code{_POSIX_SYNC_IO}.
1412 @comment unistd.h
1413 @comment POSIX.1
1414 @item _PC_ASYNC_IO
1415 Inquire about the value of @code{_POSIX_ASYNC_IO}.
1417 @comment unistd.h
1418 @comment POSIX.1
1419 @item _PC_PRIO_IO
1420 Inquire about the value of @code{_POSIX_PRIO_IO}.
1422 @comment unistd.h
1423 @comment POSIX.1g
1424 @item _PC_SOCK_MAXBUF
1425 Inquire about the value of @code{_POSIX_PIPE_BUF}.
1426 @end table
1428 @node Utility Limits
1429 @section Utility Program Capacity Limits
1431 The POSIX.2 standard specifies certain system limits that you can access
1432 through @code{sysconf} that apply to utility behavior rather than the
1433 behavior of the library or the operating system.
1435 The GNU C library defines macros for these limits, and @code{sysconf}
1436 returns values for them if you ask; but these values convey no
1437 meaningful information.  They are simply the smallest values that
1438 POSIX.2 permits.
1440 @comment limits.h
1441 @comment POSIX.2
1442 @deftypevr Macro int BC_BASE_MAX
1443 The largest value of @code{obase} 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_SCALE_MAX
1450 The largest value of @code{scale} that the @code{bc} utility is
1451 guaranteed to support.
1452 @end deftypevr
1454 @comment limits.h
1455 @comment POSIX.2
1456 @deftypevr Macro int BC_DIM_MAX
1457 The largest number of elements in one array that the @code{bc} utility
1458 is guaranteed to support.
1459 @end deftypevr
1461 @comment limits.h
1462 @comment POSIX.2
1463 @deftypevr Macro int BC_STRING_MAX
1464 The largest number of characters in one string constant that the
1465 @code{bc} utility is guaranteed to support.
1466 @end deftypevr
1468 @comment limits.h
1469 @comment POSIX.2
1470 @deftypevr Macro int BC_DIM_MAX
1471 The largest number of elements in one array that the @code{bc} utility
1472 is guaranteed to support.
1473 @end deftypevr
1475 @comment limits.h
1476 @comment POSIX.2
1477 @deftypevr Macro int COLL_WEIGHTS_MAX
1478 The largest number of weights that can necessarily be used in defining
1479 the collating sequence for a locale.
1480 @end deftypevr
1482 @comment limits.h
1483 @comment POSIX.2
1484 @deftypevr Macro int EXPR_NEST_MAX
1485 The maximum number of expressions that can be nested within parenthesis
1486 by the @code{expr} utility.
1487 @end deftypevr
1489 @comment limits.h
1490 @comment POSIX.2
1491 @deftypevr Macro int LINE_MAX
1492 The largest text line that the text-oriented POSIX.2 utilities can
1493 support.  (If you are using the GNU versions of these utilities, then
1494 there is no actual limit except that imposed by the available virtual
1495 memory, but there is no way that the library can tell you this.)
1496 @end deftypevr
1498 @comment limits.h
1499 @comment POSIX.2
1500 @deftypevr Macro int EQUIV_CLASS_MAX
1501 The maximum number of weights that can be assigned to an entry of the
1502 @code{LC_COLLATE} category @samp{order} keyword in a locale definition.
1503 The GNU C library does not presently support locale definitions.
1504 @end deftypevr
1506 @node Utility Minimums
1507 @section Minimum Values for Utility Limits
1509 @table @code
1510 @comment limits.h
1511 @comment POSIX.2
1512 @item _POSIX2_BC_BASE_MAX
1513 The most restrictive limit permitted by POSIX.2 for the maximum value of
1514 @code{obase} in the @code{bc} utility.  Its value is @code{99}.
1516 @comment limits.h
1517 @comment POSIX.2
1518 @item _POSIX2_BC_DIM_MAX
1519 The most restrictive limit permitted by POSIX.2 for the maximum size of
1520 an array in the @code{bc} utility.  Its value is @code{2048}.
1522 @comment limits.h
1523 @comment POSIX.2
1524 @item _POSIX2_BC_SCALE_MAX
1525 The most restrictive limit permitted by POSIX.2 for the maximum value of
1526 @code{scale} in the @code{bc} utility.  Its value is @code{99}.
1528 @comment limits.h
1529 @comment POSIX.2
1530 @item _POSIX2_BC_STRING_MAX
1531 The most restrictive limit permitted by POSIX.2 for the maximum size of
1532 a string constant in the @code{bc} utility.  Its value is @code{1000}.
1534 @comment limits.h
1535 @comment POSIX.2
1536 @item _POSIX2_COLL_WEIGHTS_MAX
1537 The most restrictive limit permitted by POSIX.2 for the maximum number
1538 of weights that can necessarily be used in defining the collating
1539 sequence for a locale.  Its value is @code{2}.
1541 @comment limits.h
1542 @comment POSIX.2
1543 @item _POSIX2_EXPR_NEST_MAX
1544 The most restrictive limit permitted by POSIX.2 for the maximum number
1545 of expressions nested within parenthesis when using the @code{expr} utility.
1546 Its value is @code{32}.
1548 @comment limits.h
1549 @comment POSIX.2
1550 @item _POSIX2_LINE_MAX
1551 The most restrictive limit permitted by POSIX.2 for the maximum size of
1552 a text line that the text utilities can handle.  Its value is
1553 @code{2048}.
1555 @comment limits.h
1556 @comment POSIX.2
1557 @item _POSIX2_EQUIV_CLASS_MAX
1558 The most restrictive limit permitted by POSIX.2 for the maximum number
1559 of weights that can be assigned to an entry of the @code{LC_COLLATE}
1560 category @samp{order} keyword in a locale definition.  Its value is
1561 @code{2}.  The GNU C library does not presently support locale
1562 definitions.
1563 @end table
1565 @node String Parameters
1566 @section String-Valued Parameters
1568 POSIX.2 defines a way to get string-valued parameters from the operating
1569 system with the function @code{confstr}:
1571 @comment unistd.h
1572 @comment POSIX.2
1573 @deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})
1574 This function reads the value of a string-valued system parameter,
1575 storing the string into @var{len} bytes of memory space starting at
1576 @var{buf}.  The @var{parameter} argument should be one of the
1577 @samp{_CS_} symbols listed below.
1579 The normal return value from @code{confstr} is the length of the string
1580 value that you asked for.  If you supply a null pointer for @var{buf},
1581 then @code{confstr} does not try to store the string; it just returns
1582 its length.  A value of @code{0} indicates an error.
1584 If the string you asked for is too long for the buffer (that is, longer
1585 than @code{@var{len} - 1}), then @code{confstr} stores just that much
1586 (leaving room for the terminating null character).  You can tell that
1587 this has happened because @code{confstr} returns a value greater than or
1588 equal to @var{len}.
1590 The following @code{errno} error conditions are defined for this function:
1592 @table @code
1593 @item EINVAL
1594 The value of the @var{parameter} is invalid.
1595 @end table
1596 @end deftypefun
1598 Currently there is just one parameter you can read with @code{confstr}:
1600 @table @code
1601 @comment unistd.h
1602 @comment POSIX.2
1603 @item _CS_PATH
1604 This parameter's value is the recommended default path for searching for
1605 executable files.  This is the path that a user has by default just
1606 after logging in.
1608 @comment unistd.h
1609 @comment Unix98
1610 @item _CS_LFS_CFLAGS
1611 The returned string specifies which additional flags must be given to
1612 the C compiler 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_LDFLAGS
1618 The returned string specifies which additional flags must be given to
1619 the linker 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_LIBS
1625 The returned string specifies which additional libraries must be linked
1626 to the application 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_LFS_LINTFLAGS
1632 The returned string specifies which additional flags must be given to
1633 the the lint tool if a source is compiled using the
1634 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1636 @comment unistd.h
1637 @comment Unix98
1638 @item _CS_LFS64_CFLAGS
1639 The returned string specifies which additional flags must be given to
1640 the C compiler 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_LDFLAGS
1646 The returned string specifies which additional flags must be given to
1647 the linker 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_LIBS
1653 The returned string specifies which additional libraries must be linked
1654 to the application if a source is compiled using the
1655 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1657 @comment unistd.h
1658 @comment Unix98
1659 @item _CS_LFS64_LINTFLAGS
1660 The returned string specifies which additional flags must be given to
1661 the the lint tool if a source is compiled using the
1662 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1663 @end table
1665 The way to use @code{confstr} without any arbitrary limit on string size
1666 is to call it twice: first call it to get the length, allocate the
1667 buffer accordingly, and then call @code{confstr} again to fill the
1668 buffer, like this:
1670 @smallexample
1671 @group
1672 char *
1673 get_default_path (void)
1675   size_t len = confstr (_CS_PATH, NULL, 0);
1676   char *buffer = (char *) xmalloc (len);
1678   if (confstr (_CS_PATH, buf, len + 1) == 0)
1679     @{
1680       free (buffer);
1681       return NULL;
1682     @}
1684   return buffer;
1686 @end group
1687 @end smallexample