Update.
[glibc.git] / manual / conf.texi
blobeabbce62fe05d56e98c3c309bef79955f1eb9262
1 @c This node must have no next pointer.
2 @node System Configuration, , System Information, Top
3 @c %MENU% Parameters describing operating system limits
4 @chapter System Configuration Parameters
6 The functions and macros listed in this chapter give information about
7 configuration parameters of the operating system---for example, capacity
8 limits, presence of optional POSIX features, and the default path for
9 executable files (@pxref{String Parameters}).
11 @menu
12 * General Limits::           Constants and functions that describe
13                                 various process-related limits that have
14                                 one uniform value for any given machine.
15 * System Options::           Optional POSIX features.
16 * Version Supported::        Version numbers of POSIX.1 and POSIX.2.
17 * Sysconf::                  Getting specific configuration values
18                                 of general limits and system options.
19 * Minimums::                 Minimum values for general limits.
21 * Limits for Files::         Size limitations that pertain to individual files.
22                                 These can vary between file systems
23                                 or even from file to file.
24 * Options for Files::        Optional features that some files may support.
25 * File Minimums::            Minimum values for file limits.
26 * Pathconf::                 Getting the limit values for a particular file.
28 * Utility Limits::           Capacity limits of some POSIX.2 utility programs.
29 * Utility Minimums::         Minimum allowable values of those limits.
31 * String Parameters::        Getting the default search path.
32 @end menu
34 @node General Limits
35 @section General Capacity Limits
36 @cindex POSIX capacity limits
37 @cindex limits, POSIX
38 @cindex capacity limits, POSIX
40 The POSIX.1 and POSIX.2 standards specify a number of parameters that
41 describe capacity limitations of the system.  These limits can be fixed
42 constants for a given operating system, or they can vary from machine to
43 machine.  For example, some limit values may be configurable by the
44 system administrator, either at run time or by rebuilding the kernel,
45 and this should not require recompiling application programs.
47 @pindex limits.h
48 Each of the following limit parameters has a macro that is defined in
49 @file{limits.h} only if the system has a fixed, uniform limit for the
50 parameter in question.  If the system allows different file systems or
51 files to have different limits, then the macro is undefined; use
52 @code{sysconf} to find out the limit that applies at a particular time
53 on a particular machine.  @xref{Sysconf}.
55 Each of these parameters also has another macro, with a name starting
56 with @samp{_POSIX}, which gives the lowest value that the limit is
57 allowed to have on @emph{any} POSIX system.  @xref{Minimums}.
59 @cindex limits, program argument size
60 @comment limits.h
61 @comment POSIX.1
62 @deftypevr Macro int ARG_MAX
63 If defined, the unvarying maximum combined length of the @var{argv} and
64 @var{environ} arguments that can be passed to the @code{exec} functions.
65 @end deftypevr
67 @cindex limits, number of processes
68 @comment limits.h
69 @comment POSIX.1
70 @deftypevr Macro int CHILD_MAX
71 If defined, the unvarying maximum number of processes that can exist
72 with the same real user ID at any one time.  In BSD and GNU, this is
73 controlled by the @code{RLIMIT_NPROC} resource limit; @pxref{Limits on
74 Resources}.
75 @end deftypevr
77 @cindex limits, number of open files
78 @comment limits.h
79 @comment POSIX.1
80 @deftypevr Macro int OPEN_MAX
81 If defined, the unvarying maximum number of files that a single process
82 can have open simultaneously.  In BSD and GNU, this is controlled
83 by the @code{RLIMIT_NOFILE} resource limit; @pxref{Limits on Resources}.
84 @end deftypevr
86 @comment limits.h
87 @comment POSIX.1
88 @deftypevr Macro int STREAM_MAX
89 If defined, the unvarying maximum number of streams that a single
90 process can have open simultaneously.  @xref{Opening Streams}.
91 @end deftypevr
93 @cindex limits, time zone name length
94 @comment limits.h
95 @comment POSIX.1
96 @deftypevr Macro int TZNAME_MAX
97 If defined, the unvarying maximum length of a time zone name.
98 @xref{Time Zone Functions}.
99 @end deftypevr
101 These limit macros are always defined in @file{limits.h}.
103 @cindex limits, number of supplementary group IDs
104 @comment limits.h
105 @comment POSIX.1
106 @deftypevr Macro int NGROUPS_MAX
107 The maximum number of supplementary group IDs that one process can have.
109 The value of this macro is actually a lower bound for the maximum.  That
110 is, you can count on being able to have that many supplementary group
111 IDs, but a particular machine might let you have even more.  You can use
112 @code{sysconf} to see whether a particular machine will let you have
113 more (@pxref{Sysconf}).
114 @end deftypevr
116 @comment limits.h
117 @comment POSIX.1
118 @deftypevr Macro int SSIZE_MAX
119 The largest value that can fit in an object of type @code{ssize_t}.
120 Effectively, this is the limit on the number of bytes that can be read
121 or written in a single operation.
123 This macro is defined in all POSIX systems because this limit is never
124 configurable.
125 @end deftypevr
127 @comment limits.h
128 @comment POSIX.2
129 @deftypevr Macro int RE_DUP_MAX
130 The largest number of repetitions you are guaranteed is allowed in the
131 construct @samp{\@{@var{min},@var{max}\@}} in a regular expression.
133 The value of this macro is actually a lower bound for the maximum.  That
134 is, you can count on being able to have that many repetitions, but a
135 particular machine might let you have even more.  You can use
136 @code{sysconf} to see whether a particular machine will let you have
137 more (@pxref{Sysconf}).  And even the value that @code{sysconf} tells
138 you is just a lower bound---larger values might work.
140 This macro is defined in all POSIX.2 systems, because POSIX.2 says it
141 should always be defined even if there is no specific imposed limit.
142 @end deftypevr
144 @node System Options
145 @section Overall System Options
146 @cindex POSIX optional features
147 @cindex optional POSIX features
149 POSIX defines certain system-specific options that not all POSIX systems
150 support.  Since these options are provided in the kernel, not in the
151 library, simply using the GNU C library does not guarantee any of these
152 features is supported; it depends on the system you are using.
154 @pindex unistd.h
155 You can test for the availability of a given option using the macros in
156 this section, together with the function @code{sysconf}.  The macros are
157 defined only if you include @file{unistd.h}.
159 For the following macros, if the macro is defined in @file{unistd.h},
160 then the option is supported.  Otherwise, the option may or may not be
161 supported; use @code{sysconf} to find out.  @xref{Sysconf}.
163 @comment unistd.h
164 @comment POSIX.1
165 @deftypevr Macro int _POSIX_JOB_CONTROL
166 If this symbol is defined, it indicates that the system supports job
167 control.  Otherwise, the implementation behaves as if all processes
168 within a session belong to a single process group.  @xref{Job Control}.
169 @end deftypevr
171 @comment unistd.h
172 @comment POSIX.1
173 @deftypevr Macro int _POSIX_SAVED_IDS
174 If this symbol is defined, it indicates that the system remembers the
175 effective user and group IDs of a process before it executes an
176 executable file with the set-user-ID or set-group-ID bits set, and that
177 explicitly changing the effective user or group IDs back to these values
178 is permitted.  If this option is not defined, then if a nonprivileged
179 process changes its effective user or group ID to the real user or group
180 ID of the process, it can't change it back again.  @xref{Enable/Disable
181 Setuid}.
182 @end deftypevr
184 For the following macros, if the macro is defined in @file{unistd.h},
185 then its value indicates whether the option is supported.  A value of
186 @code{-1} means no, and any other value means yes.  If the macro is not
187 defined, then the option may or may not be supported; use @code{sysconf}
188 to find out.  @xref{Sysconf}.
190 @comment unistd.h
191 @comment POSIX.2
192 @deftypevr Macro int _POSIX2_C_DEV
193 If this symbol is defined, it indicates that the system has the POSIX.2
194 C compiler command, @code{c89}.  The GNU C library always defines this
195 as @code{1}, on the assumption that you would not have installed it if
196 you didn't have a C compiler.
197 @end deftypevr
199 @comment unistd.h
200 @comment POSIX.2
201 @deftypevr Macro int _POSIX2_FORT_DEV
202 If this symbol is defined, it indicates that the system has the POSIX.2
203 Fortran compiler command, @code{fort77}.  The GNU C library never
204 defines this, because we don't know what the system has.
205 @end deftypevr
207 @comment unistd.h
208 @comment POSIX.2
209 @deftypevr Macro int _POSIX2_FORT_RUN
210 If this symbol is defined, it indicates that the system has the POSIX.2
211 @code{asa} command to interpret Fortran carriage control.  The GNU C
212 library never defines this, because we don't know what the system has.
213 @end deftypevr
215 @comment unistd.h
216 @comment POSIX.2
217 @deftypevr Macro int _POSIX2_LOCALEDEF
218 If this symbol is defined, it indicates that the system has the POSIX.2
219 @code{localedef} command.  The GNU C library never defines this, because
220 we don't know what the system has.
221 @end deftypevr
223 @comment unistd.h
224 @comment POSIX.2
225 @deftypevr Macro int _POSIX2_SW_DEV
226 If this symbol is defined, it indicates that the system has the POSIX.2
227 commands @code{ar}, @code{make}, and @code{strip}.  The GNU C library
228 always defines this as @code{1}, on the assumption that you had to have
229 @code{ar} and @code{make} to install the library, and it's unlikely that
230 @code{strip} would be absent when those are present.
231 @end deftypevr
233 @node Version Supported
234 @section Which Version of POSIX is Supported
236 @comment unistd.h
237 @comment POSIX.1
238 @deftypevr Macro {long int} _POSIX_VERSION
239 This constant represents the version of the POSIX.1 standard to which
240 the implementation conforms.  For an implementation conforming to the
241 1995 POSIX.1 standard, the value is the integer @code{199506L}.
243 @code{_POSIX_VERSION} is always defined (in @file{unistd.h}) in any
244 POSIX system.
246 @strong{Usage Note:} Don't try to test whether the system supports POSIX
247 by including @file{unistd.h} and then checking whether
248 @code{_POSIX_VERSION} is defined.  On a non-POSIX system, this will
249 probably fail because there is no @file{unistd.h}.  We do not know of
250 @emph{any} way you can reliably test at compilation time whether your
251 target system supports POSIX or whether @file{unistd.h} exists.
253 The GNU C compiler predefines the symbol @code{__POSIX__} if the target
254 system is a POSIX system.  Provided you do not use any other compilers
255 on POSIX systems, testing @code{defined (__POSIX__)} will reliably
256 detect such systems.
257 @end deftypevr
259 @comment unistd.h
260 @comment POSIX.2
261 @deftypevr Macro {long int} _POSIX2_C_VERSION
262 This constant represents the version of the POSIX.2 standard which the
263 library and system kernel support.  We don't know what value this will
264 be for the first version of the POSIX.2 standard, because the value is
265 based on the year and month in which the standard is officially adopted.
267 The value of this symbol says nothing about the utilities installed on
268 the system.
270 @strong{Usage Note:} You can use this macro to tell whether a POSIX.1
271 system library supports POSIX.2 as well.  Any POSIX.1 system contains
272 @file{unistd.h}, so include that file and then test @code{defined
273 (_POSIX2_C_VERSION)}.
274 @end deftypevr
276 @node Sysconf
277 @section Using @code{sysconf}
279 When your system has configurable system limits, you can use the
280 @code{sysconf} function to find out the value that applies to any
281 particular machine.  The function and the associated @var{parameter}
282 constants are declared in the header file @file{unistd.h}.
284 @menu
285 * Sysconf Definition::        Detailed specifications of @code{sysconf}.
286 * Constants for Sysconf::     The list of parameters @code{sysconf} can read.
287 * Examples of Sysconf::       How to use @code{sysconf} and the parameter
288                                  macros properly together.
289 @end menu
291 @node Sysconf Definition
292 @subsection Definition of @code{sysconf}
294 @comment unistd.h
295 @comment POSIX.1
296 @deftypefun {long int} sysconf (int @var{parameter})
297 This function is used to inquire about runtime system parameters.  The
298 @var{parameter} argument should be one of the @samp{_SC_} symbols listed
299 below.
301 The normal return value from @code{sysconf} is the value you requested.
302 A value of @code{-1} is returned both if the implementation does not
303 impose a limit, and in case of an error.
305 The following @code{errno} error conditions are defined for this function:
307 @table @code
308 @item EINVAL
309 The value of the @var{parameter} is invalid.
310 @end table
311 @end deftypefun
313 @node Constants for Sysconf
314 @subsection Constants for @code{sysconf} Parameters
316 Here are the symbolic constants for use as the @var{parameter} argument
317 to @code{sysconf}.  The values are all integer constants (more
318 specifically, enumeration type values).
320 @table @code
321 @comment unistd.h
322 @comment POSIX.1
323 @item _SC_ARG_MAX
324 Inquire about the parameter corresponding to @code{ARG_MAX}.
326 @comment unistd.h
327 @comment POSIX.1
328 @item _SC_CHILD_MAX
329 Inquire about the parameter corresponding to @code{CHILD_MAX}.
331 @comment unistd.h
332 @comment POSIX.1
333 @item _SC_OPEN_MAX
334 Inquire about the parameter corresponding to @code{OPEN_MAX}.
336 @comment unistd.h
337 @comment POSIX.1
338 @item _SC_STREAM_MAX
339 Inquire about the parameter corresponding to @code{STREAM_MAX}.
341 @comment unistd.h
342 @comment POSIX.1
343 @item _SC_TZNAME_MAX
344 Inquire about the parameter corresponding to @code{TZNAME_MAX}.
346 @comment unistd.h
347 @comment POSIX.1
348 @item _SC_NGROUPS_MAX
349 Inquire about the parameter corresponding to @code{NGROUPS_MAX}.
351 @comment unistd.h
352 @comment POSIX.1
353 @item _SC_JOB_CONTROL
354 Inquire about the parameter corresponding to @code{_POSIX_JOB_CONTROL}.
356 @comment unistd.h
357 @comment POSIX.1
358 @item _SC_SAVED_IDS
359 Inquire about the parameter corresponding to @code{_POSIX_SAVED_IDS}.
361 @comment unistd.h
362 @comment POSIX.1
363 @item _SC_VERSION
364 Inquire about the parameter corresponding to @code{_POSIX_VERSION}.
366 @comment unistd.h
367 @comment POSIX.1
368 @item _SC_CLK_TCK
369 Inquire about the parameter corresponding to @code{CLOCKS_PER_SEC};
370 @pxref{Basic CPU Time}.
372 @comment unistd.h
373 @comment GNU
374 @item _SC_CHARCLASS_NAME_MAX
375 Inquire about the parameter corresponding to maximal length allowed for
376 a character class name in an extended locale specification.  These
377 extensions are not yet standardized and so this option is not standardized
378 as well.
380 @comment unistdh.h
381 @comment POSIX.1
382 @item _SC_REALTIME_SIGNALS
383 Inquire about the parameter corresponding to @code{_POSIX_REALTIME_SIGNALS}.
385 @comment unistd.h
386 @comment POSIX.1
387 @item _SC_PRIORITY_SCHEDULING
388 Inquire about the parameter corresponding to @code{_POSIX_PRIORITY_SCHEDULING}.
390 @comment unistd.h
391 @comment POSIX.1
392 @item _SC_TIMERS
393 Inquire about the parameter corresponding to @code{_POSIX_TIMERS}.
395 @comment unistd.h
396 @comment POSIX.1
397 @item _SC_ASYNCHRONOUS_IO
398 Inquire about the parameter corresponding to @code{_POSIX_ASYNCHRONOUS_IO}.
400 @comment unistd.h
401 @comment POSIX.1
402 @item _SC_PRIORITIZED_IO
403 Inquire about the parameter corresponding to @code{_POSIX_PRIORITIZED_IO}.
405 @comment unistd.h
406 @comment POSIX.1
407 @item _SC_SYNCHRONIZED_IO
408 Inquire about the parameter corresponding to @code{_POSIX_SYNCHRONIZED_IO}.
410 @comment unistd.h
411 @comment POSIX.1
412 @item _SC_FSYNC
413 Inquire about the parameter corresponding to @code{_POSIX_FSYNC}.
415 @comment unistd.h
416 @comment POSIX.1
417 @item _SC_MAPPED_FILES
418 Inquire about the parameter corresponding to @code{_POSIX_MAPPED_FILES}.
420 @comment unistd.h
421 @comment POSIX.1
422 @item _SC_MEMLOCK
423 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK}.
425 @comment unistd.h
426 @comment POSIX.1
427 @item _SC_MEMLOCK_RANGE
428 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK_RANGE}.
430 @comment unistd.h
431 @comment POSIX.1
432 @item _SC_MEMORY_PROTECTION
433 Inquire about the parameter corresponding to @code{_POSIX_MEMORY_PROTECTION}.
435 @comment unistd.h
436 @comment POSIX.1
437 @item _SC_MESSAGE_PASSING
438 Inquire about the parameter corresponding to @code{_POSIX_MESSAGE_PASSING}.
440 @comment unistd.h
441 @comment POSIX.1
442 @item _SC_SEMAPHORES
443 Inquire about the parameter corresponding to @code{_POSIX_SEMAPHORES}.
445 @comment unistd.h
446 @comment POSIX.1
447 @item _SC_SHARED_MEMORY_OBJECTS
448 Inquire about the parameter corresponding to
449 @code{_POSIX_SHARED_MEMORY_OBJECTS}.
451 @comment unistd.h
452 @comment POSIX.1
453 @item _SC_AIO_LISTIO_MAX
454 Inquire about the parameter corresponding to @code{_POSIX_AIO_LISTIO_MAX}.
456 @comment unistd.h
457 @comment POSIX.1
458 @item _SC_AIO_MAX
459 Inquire about the parameter corresponding to @code{_POSIX_AIO_MAX}.
461 @comment unistd.h
462 @comment POSIX.1
463 @item _SC_AIO_PRIO_DELTA_MAX
464 Inquire the value by which a process can decrease its asynchronous I/O
465 priority level from its own scheduling priority.  This corresponds to the
466 run-time invariant value @code{AIO_PRIO_DELTA_MAX}.
468 @comment unistd.h
469 @comment POSIX.1
470 @item _SC_DELAYTIMER_MAX
471 Inquire about the parameter corresponding to @code{_POSIX_DELAYTIMER_MAX}.
473 @comment unistd.h
474 @comment POSIX.1
475 @item _SC_MQ_OPEN_MAX
476 Inquire about the parameter corresponding to @code{_POSIX_MQ_OPEN_MAX}.
478 @comment unistd.h
479 @comment POSIX.1
480 @item _SC_MQ_PRIO_MAX
481 Inquire about the parameter corresponding to @code{_POSIX_MQ_PRIO_MAX}.
483 @comment unistd.h
484 @comment POSIX.1
485 @item _SC_RTSIG_MAX
486 Inquire about the parameter corresponding to @code{_POSIX_RTSIG_MAX}.
488 @comment unistd.h
489 @comment POSIX.1
490 @item _SC_SEM_NSEMS_MAX
491 Inquire about the parameter corresponding to @code{_POSIX_SEM_NSEMS_MAX}.
493 @comment unistd.h
494 @comment POSIX.1
495 @item _SC_SEM_VALUE_MAX
496 Inquire about the parameter corresponding to @code{_POSIX_SEM_VALUE_MAX}.
498 @comment unistd.h
499 @comment POSIX.1
500 @item _SC_SIGQUEUE_MAX
501 Inquire about the parameter corresponding to @code{_POSIX_SIGQUEUE_MAX}.
503 @comment unistd.h
504 @comment POSIX.1
505 @item _SC_TIMER_MAX
506 Inquire about the parameter corresponding to @code{_POSIX_TIMER_MAX}.
508 @comment unistd.h
509 @comment POSIX.1g
510 @item _SC_PII
511 Inquire about the parameter corresponding to @code{_POSIX_PII}.
513 @comment unistd.h
514 @comment POSIX.1g
515 @item _SC_PII_XTI
516 Inquire about the parameter corresponding to @code{_POSIX_PII_XTI}.
518 @comment unistd.h
519 @comment POSIX.1g
520 @item _SC_PII_SOCKET
521 Inquire about the parameter corresponding to @code{_POSIX_PII_SOCKET}.
523 @comment unistd.h
524 @comment POSIX.1g
525 @item _SC_PII_INTERNET
526 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET}.
528 @comment unistd.h
529 @comment POSIX.1g
530 @item _SC_PII_OSI
531 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI}.
533 @comment unistd.h
534 @comment POSIX.1g
535 @item _SC_SELECT
536 Inquire about the parameter corresponding to @code{_POSIX_SELECT}.
538 @comment unistd.h
539 @comment POSIX.1g
540 @item _SC_UIO_MAXIOV
541 Inquire about the parameter corresponding to @code{_POSIX_UIO_MAXIOV}.
543 @comment unistd.h
544 @comment POSIX.1g
545 @item _SC_PII_INTERNET_STREAM
546 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_STREAM}.
548 @comment unistd.h
549 @comment POSIX.1g
550 @item _SC_PII_INTERNET_DGRAM
551 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_DGRAM}.
553 @comment unistd.h
554 @comment POSIX.1g
555 @item _SC_PII_OSI_COTS
556 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_COTS}.
558 @comment unistd.h
559 @comment POSIX.1g
560 @item _SC_PII_OSI_CLTS
561 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_CLTS}.
563 @comment unistd.h
564 @comment POSIX.1g
565 @item _SC_PII_OSI_M
566 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_M}.
568 @comment unistd.h
569 @comment POSIX.1g
570 @item _SC_T_IOV_MAX
571 Inquire the value of the value associated with the @code{T_IOV_MAX}
572 variable.
574 @comment unistd.h
575 @comment POSIX.1
576 @item _SC_THREADS
577 Inquire about the parameter corresponding to @code{_POSIX_THREADS}.
579 @comment unistd.h
580 @comment POSIX.1
581 @item _SC_THREAD_SAFE_FUNCTIONS
582 Inquire about the parameter corresponding to
583 @code{_POSIX_THREAD_SAFE_FUNCTIONS}.
585 @comment unistd.h
586 @comment POSIX.1
587 @item _SC_GETGR_R_SIZE_MAX
588 Inquire about the parameter corresponding to @code{_POSIX_GETGR_R_SIZE_MAX}.
590 @comment unistd.h
591 @comment POSIX.1
592 @item _SC_GETPW_R_SIZE_MAX
593 Inquire about the parameter corresponding to @code{_POSIX_GETPW_R_SIZE_MAX}.
595 @comment unistd.h
596 @comment POSIX.1
597 @item _SC_LOGIN_NAME_MAX
598 Inquire about the parameter corresponding to @code{_POSIX_LOGIN_NAME_MAX}.
600 @comment unistd.h
601 @comment POSIX.1
602 @item _SC_TTY_NAME_MAX
603 Inquire about the parameter corresponding to @code{_POSIX_TTY_NAME_MAX}.
605 @comment unistd.h
606 @comment POSIX.1
607 @item _SC_THREAD_DESTRUCTOR_ITERATIONS
608 Inquire about the parameter corresponding to
609 @code{_POSIX_THREAD_DESTRUCTOR_ITERATIONS}.
611 @comment unistd.h
612 @comment POSIX.1
613 @item _SC_THREAD_KEYS_MAX
614 Inquire about the parameter corresponding to @code{_POSIX_THREAD_KEYS_MAX}.
616 @comment unistd.h
617 @comment POSIX.1
618 @item _SC_THREAD_STACK_MIN
619 Inquire about the parameter corresponding to @code{_POSIX_THREAD_STACK_MIN}.
621 @comment unistd.h
622 @comment POSIX.1
623 @item _SC_THREAD_THREADS_MAX
624 Inquire about the parameter corresponding to @code{_POSIX_THREAD_THREADS_MAX}.
626 @comment unistd.h
627 @comment POSIX.1
628 @item _SC_THREAD_ATTR_STACKADDR
629 Inquire about the parameter corresponding to
630 @code{_POSIX_THREAD_ATTR_STACKADDR}.
632 @comment unistd.h
633 @comment POSIX.1
634 @item _SC_THREAD_ATTR_STACKSIZE
635 Inquire about the parameter corresponding to
636 @code{_POSIX_THREAD_ATTR_STACKSIZE}.
638 @comment unistd.h
639 @comment POSIX.1
640 @item _SC_THREAD_PRIORITY_SCHEDULING
641 Inquire about the parameter corresponding to
642 @code{_POSIX_THREAD_PRIORITY_SCHEDULING}.
644 @comment unistd.h
645 @comment POSIX.1
646 @item _SC_THREAD_PRIO_INHERIT
647 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_INHERIT}.
649 @comment unistd.h
650 @comment POSIX.1
651 @item _SC_THREAD_PRIO_PROTECT
652 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_PROTECT}.
654 @comment unistd.h
655 @comment POSIX.1
656 @item _SC_THREAD_PROCESS_SHARED
657 Inquire about the parameter corresponding to
658 @code{_POSIX_THREAD_PROCESS_SHARED}.
660 @comment unistd.h
661 @comment POSIX.2
662 @item _SC_2_C_DEV
663 Inquire about whether the system has the POSIX.2 C compiler command,
664 @code{c89}.
666 @comment unistd.h
667 @comment POSIX.2
668 @item _SC_2_FORT_DEV
669 Inquire about whether the system has the POSIX.2 Fortran compiler
670 command, @code{fort77}.
672 @comment unistd.h
673 @comment POSIX.2
674 @item _SC_2_FORT_RUN
675 Inquire about whether the system has the POSIX.2 @code{asa} command to
676 interpret Fortran carriage control.
678 @comment unistd.h
679 @comment POSIX.2
680 @item _SC_2_LOCALEDEF
681 Inquire about whether the system has the POSIX.2 @code{localedef}
682 command.
684 @comment unistd.h
685 @comment POSIX.2
686 @item _SC_2_SW_DEV
687 Inquire about whether the system has the POSIX.2 commands @code{ar},
688 @code{make}, and @code{strip}.
690 @comment unistd.h
691 @comment POSIX.2
692 @item _SC_BC_BASE_MAX
693 Inquire about the maximum value of @code{obase} in the @code{bc}
694 utility.
696 @comment unistd.h
697 @comment POSIX.2
698 @item _SC_BC_DIM_MAX
699 Inquire about the maximum size of an array in the @code{bc}
700 utility.
702 @comment unistd.h
703 @comment POSIX.2
704 @item _SC_BC_SCALE_MAX
705 Inquire about the maximum value of @code{scale} in the @code{bc}
706 utility.
708 @comment unistd.h
709 @comment POSIX.2
710 @item _SC_BC_STRING_MAX
711 Inquire about the maximum size of a string constant in the
712 @code{bc} utility.
714 @comment unistd.h
715 @comment POSIX.2
716 @item _SC_COLL_WEIGHTS_MAX
717 Inquire about the maximum number of weights that can necessarily
718 be used in defining the collating sequence for a locale.
720 @comment unistd.h
721 @comment POSIX.2
722 @item _SC_EXPR_NEST_MAX
723 Inquire about the maximum number of expressions nested within
724 parentheses when using the @code{expr} utility.
726 @comment unistd.h
727 @comment POSIX.2
728 @item _SC_LINE_MAX
729 Inquire about the maximum size of a text line that the POSIX.2 text
730 utilities can handle.
732 @comment unistd.h
733 @comment POSIX.2
734 @item _SC_EQUIV_CLASS_MAX
735 Inquire about the maximum number of weights that can be assigned to an
736 entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale
737 definition.  The GNU C library does not presently support locale
738 definitions.
740 @comment unistd.h
741 @comment POSIX.2
742 @item _SC_VERSION
743 Inquire about the version number of POSIX.1 that the library and kernel
744 support.
746 @comment unistd.h
747 @comment POSIX.2
748 @item _SC_2_VERSION
749 Inquire about the version number of POSIX.2 that the system utilities
750 support.
752 @comment unistd.h
753 @comment GNU
754 @item _SC_PAGESIZE
755 Inquire about the virtual memory page size of the machine.
756 @code{getpagesize} returns the same value.
757 @c @xref{XXX getpagesize}. !!! ???
759 @comment unistd.h
760 @comment GNU
761 @item _SC_NPROCESSORS_CONF
762 Inquire about number of configured processors.
764 @comment unistd.h
765 @comment GNU
766 @item _SC_NPROCESSORS_ONLN
767 Inquire about number of processors online.
769 @comment unistd.h
770 @comment GNU
771 @item _SC_PHYS_PAGES
772 Inquire about number of physical pages in the system.
774 @comment unistd.h
775 @comment GNU
776 @item _SC_AVPHYS_PAGES
777 Inquire about number of available physical pages in the system.
779 @comment unistd.h
780 @comment GNU
781 @item _SC_ATEXIT_MAX
782 Inquire about number of functions which can be registered as termination
783 functions for @code{atexit}; @pxref{Cleanups on Exit}.
785 @comment unistd.h
786 @comment X/Open
787 @item _SC_XOPEN_VERSION
788 Inquire about the parameter corresponding to @code{_XOPEN_VERSION}.
790 @comment unistd.h
791 @comment X/Open
792 @item _SC_XOPEN_XCU_VERSION
793 Inquire about the parameter corresponding to @code{_XOPEN_XCU_VERSION}.
795 @comment unistd.h
796 @comment X/Open
797 @item _SC_XOPEN_UNIX
798 Inquire about the parameter corresponding to @code{_XOPEN_UNIX}.
800 @comment unistd.h
801 @comment X/Open
802 @item _SC_XOPEN_CRYPT
803 Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
805 @comment unistd.h
806 @comment X/Open
807 @item _SC_XOPEN_ENH_I18N
808 Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
810 @comment unistd.h
811 @comment X/Open
812 @item _SC_XOPEN_SHM
813 Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
815 @comment unistd.h
816 @comment X/Open
817 @item _SC_XOPEN_XPG2
818 Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
820 @comment unistd.h
821 @comment X/Open
822 @item _SC_XOPEN_XPG3
823 Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
825 @comment unistd.h
826 @comment X/Open
827 @item _SC_XOPEN_XPG4
828 Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
830 @comment unistd.h
831 @comment X/Open
832 @item _SC_CHAR_BIT
833 Inquire about number of bits in a variable of type @code{char}.
835 @comment unistd.h
836 @comment X/Open
837 @item _SC_CHAR_MAX
838 Inquire about maximum value which can be stored in a variable of type
839 @code{char}.
841 @comment unistd.h
842 @comment X/Open
843 @item _SC_CHAR_MIN
844 Inquire about minimum value which can be stored in a variable of type
845 @code{char}.
847 @comment unistd.h
848 @comment X/Open
849 @item _SC_INT_MAX
850 Inquire about maximum value which can be stored in a variable of type
851 @code{int}.
853 @comment unistd.h
854 @comment X/Open
855 @item _SC_INT_MIN
856 Inquire about minimum value which can be stored in a variable of type
857 @code{int}.
859 @comment unistd.h
860 @comment X/Open
861 @item _SC_LONG_BIT
862 Inquire about number of bits in a variable of type @code{long int}.
864 @comment unistd.h
865 @comment X/Open
866 @item _SC_WORD_BIT
867 Inquire about number of bits in a variable of a register word.
869 @comment unistd.h
870 @comment X/Open
871 @item _SC_MB_LEN_MAX
872 Inquire the maximum length of a multi-byte representation of a wide
873 character value.
875 @comment unistd.h
876 @comment X/Open
877 @item _SC_NZERO
878 Inquire value used to internally represent the zero priority level for
879 the process execution.
881 @comment unistd.h
882 @comment X/Open
883 @item SC_SSIZE_MAX
884 Inquire about maximum value which can be stored in a variable of type
885 @code{ssize_t}.
887 @comment unistd.h
888 @comment X/Open
889 @item _SC_SCHAR_MAX
890 Inquire about maximum value which can be stored in a variable of type
891 @code{signed char}.
893 @comment unistd.h
894 @comment X/Open
895 @item _SC_SCHAR_MIN
896 Inquire about minimum value which can be stored in a variable of type
897 @code{signed char}.
899 @comment unistd.h
900 @comment X/Open
901 @item _SC_SHRT_MAX
902 Inquire about maximum value which can be stored in a variable of type
903 @code{short int}.
905 @comment unistd.h
906 @comment X/Open
907 @item _SC_SHRT_MIN
908 Inquire about minimum value which can be stored in a variable of type
909 @code{short int}.
911 @comment unistd.h
912 @comment X/Open
913 @item _SC_UCHAR_MAX
914 Inquire about maximum value which can be stored in a variable of type
915 @code{unsigned char}.
917 @comment unistd.h
918 @comment X/Open
919 @item _SC_UINT_MAX
920 Inquire about maximum value which can be stored in a variable of type
921 @code{unsigned int}.
923 @comment unistd.h
924 @comment X/Open
925 @item _SC_ULONG_MAX
926 Inquire about maximum value which can be stored in a variable of type
927 @code{unsigned long int}.
929 @comment unistd.h
930 @comment X/Open
931 @item _SC_USHRT_MAX
932 Inquire about maximum value which can be stored in a variable of type
933 @code{unsigned short int}.
935 @comment unistd.h
936 @comment X/Open
937 @item _SC_NL_ARGMAX
938 Inquire about the parameter corresponding to @code{NL_ARGMAX}.
940 @comment unistd.h
941 @comment X/Open
942 @item _SC_NL_LANGMAX
943 Inquire about the parameter corresponding to @code{NL_LANGMAX}.
945 @comment unistd.h
946 @comment X/Open
947 @item _SC_NL_MSGMAX
948 Inquire about the parameter corresponding to @code{NL_MSGMAX}.
950 @comment unistd.h
951 @comment X/Open
952 @item _SC_NL_NMAX
953 Inquire about  the parameter corresponding to @code{NL_NMAX}.
955 @comment unistd.h
956 @comment X/Open
957 @item _SC_NL_SETMAX
958 Inquire about  the parameter corresponding to @code{NL_SETMAX}.
960 @comment unistd.h
961 @comment X/Open
962 @item _SC_NL_TEXTMAX
963 Inquire about  the parameter corresponding to @code{NL_TEXTMAX}.
964 @end table
966 @node Examples of Sysconf
967 @subsection Examples of @code{sysconf}
969 We recommend that you first test for a macro definition for the
970 parameter you are interested in, and call @code{sysconf} only if the
971 macro is not defined.  For example, here is how to test whether job
972 control is supported:
974 @smallexample
975 @group
977 have_job_control (void)
979 #ifdef _POSIX_JOB_CONTROL
980   return 1;
981 #else
982   int value = sysconf (_SC_JOB_CONTROL);
983   if (value < 0)
984     /* @r{If the system is that badly wedged,}
985        @r{there's no use trying to go on.}  */
986     fatal (strerror (errno));
987   return value;
988 #endif
990 @end group
991 @end smallexample
993 Here is how to get the value of a numeric limit:
995 @smallexample
997 get_child_max ()
999 #ifdef CHILD_MAX
1000   return CHILD_MAX;
1001 #else
1002   int value = sysconf (_SC_CHILD_MAX);
1003   if (value < 0)
1004     fatal (strerror (errno));
1005   return value;
1006 #endif
1008 @end smallexample
1010 @node Minimums
1011 @section Minimum Values for General Capacity Limits
1013 Here are the names for the POSIX minimum upper bounds for the system
1014 limit parameters.  The significance of these values is that you can
1015 safely push to these limits without checking whether the particular
1016 system you are using can go that far.
1018 @table @code
1019 @comment limits.h
1020 @comment POSIX.1
1021 @item _POSIX_AIO_LISTIO_MAX
1022 The most restrictive limit permitted by POSIX for the maximum number of
1023 I/O operations that can be specified in a list I/O call.  The value of
1024 this constant is @code{2}; thus you can add up to two new entries
1025 of the list of outstandard operations.
1027 @comment limits.h
1028 @comment POSIX.1
1029 @item _POSIX_AIO_MAX
1030 The most restrictive limit permitted by POSIX for the maximum number of
1031 outstanding asynchronous I/O operations.  The value of this constant is
1032 @code{1}.  So you cannot expect that you can issue more than one
1033 operation and immediately continue with the normal work, receiving the
1034 notifications asynchronously.
1036 @comment limits.h
1037 @comment POSIX.1
1038 @item _POSIX_ARG_MAX
1039 The value of this macro is the most restrictive limit permitted by POSIX
1040 for the maximum combined length of the @var{argv} and @var{environ}
1041 arguments that can be passed to the @code{exec} functions.
1042 Its value is @code{4096}.
1044 @comment limits.h
1045 @comment POSIX.1
1046 @item _POSIX_CHILD_MAX
1047 The value of this macro is the most restrictive limit permitted by POSIX
1048 for the maximum number of simultaneous processes per real user ID.  Its
1049 value is @code{6}.
1051 @comment limits.h
1052 @comment POSIX.1
1053 @item _POSIX_NGROUPS_MAX
1054 The value of this macro is the most restrictive limit permitted by POSIX
1055 for the maximum number of supplementary group IDs per process.  Its
1056 value is @code{0}.
1058 @comment limits.h
1059 @comment POSIX.1
1060 @item _POSIX_OPEN_MAX
1061 The value of this macro is the most restrictive limit permitted by POSIX
1062 for the maximum number of files that a single process can have open
1063 simultaneously.  Its value is @code{16}.
1065 @comment limits.h
1066 @comment POSIX.1
1067 @item _POSIX_SSIZE_MAX
1068 The value of this macro is the most restrictive limit permitted by POSIX
1069 for the maximum value that can be stored in an object of type
1070 @code{ssize_t}.  Its value is @code{32767}.
1072 @comment limits.h
1073 @comment POSIX.1
1074 @item _POSIX_STREAM_MAX
1075 The value of this macro is the most restrictive limit permitted by POSIX
1076 for the maximum number of streams that a single process can have open
1077 simultaneously.  Its value is @code{8}.
1079 @comment limits.h
1080 @comment POSIX.1
1081 @item _POSIX_TZNAME_MAX
1082 The value of this macro is the most restrictive limit permitted by POSIX
1083 for the maximum length of a time zone name.  Its value is @code{3}.
1085 @comment limits.h
1086 @comment POSIX.2
1087 @item _POSIX2_RE_DUP_MAX
1088 The value of this macro is the most restrictive limit permitted by POSIX
1089 for the numbers used in the @samp{\@{@var{min},@var{max}\@}} construct
1090 in a regular expression.  Its value is @code{255}.
1091 @end table
1093 @node Limits for Files
1094 @section Limits on File System Capacity
1096 The POSIX.1 standard specifies a number of parameters that describe the
1097 limitations of the file system.  It's possible for the system to have a
1098 fixed, uniform limit for a parameter, but this isn't the usual case.  On
1099 most systems, it's possible for different file systems (and, for some
1100 parameters, even different files) to have different maximum limits.  For
1101 example, this is very likely if you use NFS to mount some of the file
1102 systems from other machines.
1104 @pindex limits.h
1105 Each of the following macros is defined in @file{limits.h} only if the
1106 system has a fixed, uniform limit for the parameter in question.  If the
1107 system allows different file systems or files to have different limits,
1108 then the macro is undefined; use @code{pathconf} or @code{fpathconf} to
1109 find out the limit that applies to a particular file.  @xref{Pathconf}.
1111 Each parameter also has another macro, with a name starting with
1112 @samp{_POSIX}, which gives the lowest value that the limit is allowed to
1113 have on @emph{any} POSIX system.  @xref{File Minimums}.
1115 @cindex limits, link count of files
1116 @comment limits.h
1117 @comment POSIX.1
1118 @deftypevr Macro int LINK_MAX
1119 The uniform system limit (if any) for the number of names for a given
1120 file.  @xref{Hard Links}.
1121 @end deftypevr
1123 @cindex limits, terminal input queue
1124 @comment limits.h
1125 @comment POSIX.1
1126 @deftypevr Macro int MAX_CANON
1127 The uniform system limit (if any) for the amount of text in a line of
1128 input when input editing is enabled.  @xref{Canonical or Not}.
1129 @end deftypevr
1131 @comment limits.h
1132 @comment POSIX.1
1133 @deftypevr Macro int MAX_INPUT
1134 The uniform system limit (if any) for the total number of characters
1135 typed ahead as input.  @xref{I/O Queues}.
1136 @end deftypevr
1138 @cindex limits, file name length
1139 @comment limits.h
1140 @comment POSIX.1
1141 @deftypevr Macro int NAME_MAX
1142 The uniform system limit (if any) for the length of a file name component.
1143 @end deftypevr
1145 @comment limits.h
1146 @comment POSIX.1
1147 @deftypevr Macro int PATH_MAX
1148 The uniform system limit (if any) for the length of an entire file name (that
1149 is, the argument given to system calls such as @code{open}).
1150 @end deftypevr
1152 @cindex limits, pipe buffer size
1153 @comment limits.h
1154 @comment POSIX.1
1155 @deftypevr Macro int PIPE_BUF
1156 The uniform system limit (if any) for the number of bytes that can be
1157 written atomically to a pipe.  If multiple processes are writing to the
1158 same pipe simultaneously, output from different processes might be
1159 interleaved in chunks of this size.  @xref{Pipes and FIFOs}.
1160 @end deftypevr
1162 These are alternative macro names for some of the same information.
1164 @comment dirent.h
1165 @comment BSD
1166 @deftypevr Macro int MAXNAMLEN
1167 This is the BSD name for @code{NAME_MAX}.  It is defined in
1168 @file{dirent.h}.
1169 @end deftypevr
1171 @comment stdio.h
1172 @comment ISO
1173 @deftypevr Macro int FILENAME_MAX
1174 The value of this macro is an integer constant expression that
1175 represents the maximum length of a file name string.  It is defined in
1176 @file{stdio.h}.
1178 Unlike @code{PATH_MAX}, this macro is defined even if there is no actual
1179 limit imposed.  In such a case, its value is typically a very large
1180 number.  @strong{This is always the case on the GNU system.}
1182 @strong{Usage Note:} Don't use @code{FILENAME_MAX} as the size of an
1183 array in which to store a file name!  You can't possibly make an array
1184 that big!  Use dynamic allocation (@pxref{Memory Allocation}) instead.
1185 @end deftypevr
1187 @node Options for Files
1188 @section Optional Features in File Support
1190 POSIX defines certain system-specific options in the system calls for
1191 operating on files.  Some systems support these options and others do
1192 not.  Since these options are provided in the kernel, not in the
1193 library, simply using the GNU C library does not guarantee any of these
1194 features is supported; it depends on the system you are using.  They can
1195 also vary between file systems on a single machine.
1197 @pindex unistd.h
1198 This section describes the macros you can test to determine whether a
1199 particular option is supported on your machine.  If a given macro is
1200 defined in @file{unistd.h}, then its value says whether the
1201 corresponding feature is supported.  (A value of @code{-1} indicates no;
1202 any other value indicates yes.)  If the macro is undefined, it means
1203 particular files may or may not support the feature.
1205 Since all the machines that support the GNU C library also support NFS,
1206 one can never make a general statement about whether all file systems
1207 support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC}
1208 features.  So these names are never defined as macros in the GNU C
1209 library.
1211 @comment unistd.h
1212 @comment POSIX.1
1213 @deftypevr Macro int _POSIX_CHOWN_RESTRICTED
1214 If this option is in effect, the @code{chown} function is restricted so
1215 that the only changes permitted to nonprivileged processes is to change
1216 the group owner of a file to either be the effective group ID of the
1217 process, or one of its supplementary group IDs.  @xref{File Owner}.
1218 @end deftypevr
1220 @comment unistd.h
1221 @comment POSIX.1
1222 @deftypevr Macro int _POSIX_NO_TRUNC
1223 If this option is in effect, file name components longer than
1224 @code{NAME_MAX} generate an @code{ENAMETOOLONG} error.  Otherwise, file
1225 name components that are too long are silently truncated.
1226 @end deftypevr
1228 @comment unistd.h
1229 @comment POSIX.1
1230 @deftypevr Macro {unsigned char} _POSIX_VDISABLE
1231 This option is only meaningful for files that are terminal devices.
1232 If it is enabled, then handling for special control characters can
1233 be disabled individually.  @xref{Special Characters}.
1234 @end deftypevr
1236 @pindex unistd.h
1237 If one of these macros is undefined, that means that the option might be
1238 in effect for some files and not for others.  To inquire about a
1239 particular file, call @code{pathconf} or @code{fpathconf}.
1240 @xref{Pathconf}.
1242 @node File Minimums
1243 @section Minimum Values for File System Limits
1245 Here are the names for the POSIX minimum upper bounds for some of the
1246 above parameters.  The significance of these values is that you can
1247 safely push to these limits without checking whether the particular
1248 system you are using can go that far.  In most cases GNU systems do not
1249 have these strict limitations.  The actual limit should be requested if
1250 necessary.
1252 @table @code
1253 @comment limits.h
1254 @comment POSIX.1
1255 @item _POSIX_LINK_MAX
1256 The most restrictive limit permitted by POSIX for the maximum value of a
1257 file's link count.  The value of this constant is @code{8}; thus, you
1258 can always make up to eight names for a file without running into a
1259 system limit.
1261 @comment limits.h
1262 @comment POSIX.1
1263 @item _POSIX_MAX_CANON
1264 The most restrictive limit permitted by POSIX for the maximum number of
1265 bytes in a canonical input line from a terminal device.  The value of
1266 this constant is @code{255}.
1268 @comment limits.h
1269 @comment POSIX.1
1270 @item _POSIX_MAX_INPUT
1271 The most restrictive limit permitted by POSIX for the maximum number of
1272 bytes in a terminal device input queue (or typeahead buffer).
1273 @xref{Input Modes}.  The value of this constant is @code{255}.
1275 @comment limits.h
1276 @comment POSIX.1
1277 @item _POSIX_NAME_MAX
1278 The most restrictive limit permitted by POSIX for the maximum number of
1279 bytes in a file name component.  The value of this constant is
1280 @code{14}.
1282 @comment limits.h
1283 @comment POSIX.1
1284 @item _POSIX_PATH_MAX
1285 The most restrictive limit permitted by POSIX for the maximum number of
1286 bytes in a file name.  The value of this constant is @code{255}.
1288 @comment limits.h
1289 @comment POSIX.1
1290 @item _POSIX_PIPE_BUF
1291 The most restrictive limit permitted by POSIX for the maximum number of
1292 bytes that can be written atomically to a pipe.  The value of this
1293 constant is @code{512}.
1294 @end table
1296 @node Pathconf
1297 @section Using @code{pathconf}
1299 When your machine allows different files to have different values for a
1300 file system parameter, you can use the functions in this section to find
1301 out the value that applies to any particular file.
1303 These functions and the associated constants for the @var{parameter}
1304 argument are declared in the header file @file{unistd.h}.
1306 @comment unistd.h
1307 @comment POSIX.1
1308 @deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})
1309 This function is used to inquire about the limits that apply to
1310 the file named @var{filename}.
1312 The @var{parameter} argument should be one of the @samp{_PC_} constants
1313 listed below.
1315 The normal return value from @code{pathconf} is the value you requested.
1316 A value of @code{-1} is returned both if the implementation does not
1317 impose a limit, and in case of an error.  In the former case,
1318 @code{errno} is not set, while in the latter case, @code{errno} is set
1319 to indicate the cause of the problem.  So the only way to use this
1320 function robustly is to store @code{0} into @code{errno} just before
1321 calling it.
1323 Besides the usual file name errors (@pxref{File Name Errors}),
1324 the following error condition is defined for this function:
1326 @table @code
1327 @item EINVAL
1328 The value of @var{parameter} is invalid, or the implementation doesn't
1329 support the @var{parameter} for the specific file.
1330 @end table
1331 @end deftypefun
1333 @comment unistd.h
1334 @comment POSIX.1
1335 @deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})
1336 This is just like @code{pathconf} except that an open file descriptor
1337 is used to specify the file for which information is requested, instead
1338 of a file name.
1340 The following @code{errno} error conditions are defined for this function:
1342 @table @code
1343 @item EBADF
1344 The @var{filedes} argument is not a valid file descriptor.
1346 @item EINVAL
1347 The value of @var{parameter} is invalid, or the implementation doesn't
1348 support the @var{parameter} for the specific file.
1349 @end table
1350 @end deftypefun
1352 Here are the symbolic constants that you can use as the @var{parameter}
1353 argument to @code{pathconf} and @code{fpathconf}.  The values are all
1354 integer constants.
1356 @table @code
1357 @comment unistd.h
1358 @comment POSIX.1
1359 @item _PC_LINK_MAX
1360 Inquire about the value of @code{LINK_MAX}.
1362 @comment unistd.h
1363 @comment POSIX.1
1364 @item _PC_MAX_CANON
1365 Inquire about the value of @code{MAX_CANON}.
1367 @comment unistd.h
1368 @comment POSIX.1
1369 @item _PC_MAX_INPUT
1370 Inquire about the value of @code{MAX_INPUT}.
1372 @comment unistd.h
1373 @comment POSIX.1
1374 @item _PC_NAME_MAX
1375 Inquire about the value of @code{NAME_MAX}.
1377 @comment unistd.h
1378 @comment POSIX.1
1379 @item _PC_PATH_MAX
1380 Inquire about the value of @code{PATH_MAX}.
1382 @comment unistd.h
1383 @comment POSIX.1
1384 @item _PC_PIPE_BUF
1385 Inquire about the value of @code{PIPE_BUF}.
1387 @comment unistd.h
1388 @comment POSIX.1
1389 @item _PC_CHOWN_RESTRICTED
1390 Inquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.
1392 @comment unistd.h
1393 @comment POSIX.1
1394 @item _PC_NO_TRUNC
1395 Inquire about the value of @code{_POSIX_NO_TRUNC}.
1397 @comment unistd.h
1398 @comment POSIX.1
1399 @item _PC_VDISABLE
1400 Inquire about the value of @code{_POSIX_VDISABLE}.
1402 @comment unistd.h
1403 @comment POSIX.1
1404 @item _PC_SYNC_IO
1405 Inquire about the value of @code{_POSIX_SYNC_IO}.
1407 @comment unistd.h
1408 @comment POSIX.1
1409 @item _PC_ASYNC_IO
1410 Inquire about the value of @code{_POSIX_ASYNC_IO}.
1412 @comment unistd.h
1413 @comment POSIX.1
1414 @item _PC_PRIO_IO
1415 Inquire about the value of @code{_POSIX_PRIO_IO}.
1417 @comment unistd.h
1418 @comment POSIX.1g
1419 @item _PC_SOCK_MAXBUF
1420 Inquire about the value of @code{_POSIX_PIPE_BUF}.
1421 @end table
1423 @node Utility Limits
1424 @section Utility Program Capacity Limits
1426 The POSIX.2 standard specifies certain system limits that you can access
1427 through @code{sysconf} that apply to utility behavior rather than the
1428 behavior of the library or the operating system.
1430 The GNU C library defines macros for these limits, and @code{sysconf}
1431 returns values for them if you ask; but these values convey no
1432 meaningful information.  They are simply the smallest values that
1433 POSIX.2 permits.
1435 @comment limits.h
1436 @comment POSIX.2
1437 @deftypevr Macro int BC_BASE_MAX
1438 The largest value of @code{obase} that the @code{bc} utility is
1439 guaranteed to support.
1440 @end deftypevr
1442 @comment limits.h
1443 @comment POSIX.2
1444 @deftypevr Macro int BC_SCALE_MAX
1445 The largest value of @code{scale} that the @code{bc} utility is
1446 guaranteed to support.
1447 @end deftypevr
1449 @comment limits.h
1450 @comment POSIX.2
1451 @deftypevr Macro int BC_DIM_MAX
1452 The largest number of elements in one array that the @code{bc} utility
1453 is guaranteed to support.
1454 @end deftypevr
1456 @comment limits.h
1457 @comment POSIX.2
1458 @deftypevr Macro int BC_STRING_MAX
1459 The largest number of characters in one string constant that the
1460 @code{bc} utility is guaranteed to support.
1461 @end deftypevr
1463 @comment limits.h
1464 @comment POSIX.2
1465 @deftypevr Macro int BC_DIM_MAX
1466 The largest number of elements in one array that the @code{bc} utility
1467 is guaranteed to support.
1468 @end deftypevr
1470 @comment limits.h
1471 @comment POSIX.2
1472 @deftypevr Macro int COLL_WEIGHTS_MAX
1473 The largest number of weights that can necessarily be used in defining
1474 the collating sequence for a locale.
1475 @end deftypevr
1477 @comment limits.h
1478 @comment POSIX.2
1479 @deftypevr Macro int EXPR_NEST_MAX
1480 The maximum number of expressions that can be nested within parenthesis
1481 by the @code{expr} utility.
1482 @end deftypevr
1484 @comment limits.h
1485 @comment POSIX.2
1486 @deftypevr Macro int LINE_MAX
1487 The largest text line that the text-oriented POSIX.2 utilities can
1488 support.  (If you are using the GNU versions of these utilities, then
1489 there is no actual limit except that imposed by the available virtual
1490 memory, but there is no way that the library can tell you this.)
1491 @end deftypevr
1493 @comment limits.h
1494 @comment POSIX.2
1495 @deftypevr Macro int EQUIV_CLASS_MAX
1496 The maximum number of weights that can be assigned to an entry of the
1497 @code{LC_COLLATE} category @samp{order} keyword in a locale definition.
1498 The GNU C library does not presently support locale definitions.
1499 @end deftypevr
1501 @node Utility Minimums
1502 @section Minimum Values for Utility Limits
1504 @table @code
1505 @comment limits.h
1506 @comment POSIX.2
1507 @item _POSIX2_BC_BASE_MAX
1508 The most restrictive limit permitted by POSIX.2 for the maximum value of
1509 @code{obase} in the @code{bc} utility.  Its value is @code{99}.
1511 @comment limits.h
1512 @comment POSIX.2
1513 @item _POSIX2_BC_DIM_MAX
1514 The most restrictive limit permitted by POSIX.2 for the maximum size of
1515 an array in the @code{bc} utility.  Its value is @code{2048}.
1517 @comment limits.h
1518 @comment POSIX.2
1519 @item _POSIX2_BC_SCALE_MAX
1520 The most restrictive limit permitted by POSIX.2 for the maximum value of
1521 @code{scale} in the @code{bc} utility.  Its value is @code{99}.
1523 @comment limits.h
1524 @comment POSIX.2
1525 @item _POSIX2_BC_STRING_MAX
1526 The most restrictive limit permitted by POSIX.2 for the maximum size of
1527 a string constant in the @code{bc} utility.  Its value is @code{1000}.
1529 @comment limits.h
1530 @comment POSIX.2
1531 @item _POSIX2_COLL_WEIGHTS_MAX
1532 The most restrictive limit permitted by POSIX.2 for the maximum number
1533 of weights that can necessarily be used in defining the collating
1534 sequence for a locale.  Its value is @code{2}.
1536 @comment limits.h
1537 @comment POSIX.2
1538 @item _POSIX2_EXPR_NEST_MAX
1539 The most restrictive limit permitted by POSIX.2 for the maximum number
1540 of expressions nested within parenthesis when using the @code{expr} utility.
1541 Its value is @code{32}.
1543 @comment limits.h
1544 @comment POSIX.2
1545 @item _POSIX2_LINE_MAX
1546 The most restrictive limit permitted by POSIX.2 for the maximum size of
1547 a text line that the text utilities can handle.  Its value is
1548 @code{2048}.
1550 @comment limits.h
1551 @comment POSIX.2
1552 @item _POSIX2_EQUIV_CLASS_MAX
1553 The most restrictive limit permitted by POSIX.2 for the maximum number
1554 of weights that can be assigned to an entry of the @code{LC_COLLATE}
1555 category @samp{order} keyword in a locale definition.  Its value is
1556 @code{2}.  The GNU C library does not presently support locale
1557 definitions.
1558 @end table
1560 @node String Parameters
1561 @section String-Valued Parameters
1563 POSIX.2 defines a way to get string-valued parameters from the operating
1564 system with the function @code{confstr}:
1566 @comment unistd.h
1567 @comment POSIX.2
1568 @deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})
1569 This function reads the value of a string-valued system parameter,
1570 storing the string into @var{len} bytes of memory space starting at
1571 @var{buf}.  The @var{parameter} argument should be one of the
1572 @samp{_CS_} symbols listed below.
1574 The normal return value from @code{confstr} is the length of the string
1575 value that you asked for.  If you supply a null pointer for @var{buf},
1576 then @code{confstr} does not try to store the string; it just returns
1577 its length.  A value of @code{0} indicates an error.
1579 If the string you asked for is too long for the buffer (that is, longer
1580 than @code{@var{len} - 1}), then @code{confstr} stores just that much
1581 (leaving room for the terminating null character).  You can tell that
1582 this has happened because @code{confstr} returns a value greater than or
1583 equal to @var{len}.
1585 The following @code{errno} error conditions are defined for this function:
1587 @table @code
1588 @item EINVAL
1589 The value of the @var{parameter} is invalid.
1590 @end table
1591 @end deftypefun
1593 Currently there is just one parameter you can read with @code{confstr}:
1595 @table @code
1596 @comment unistd.h
1597 @comment POSIX.2
1598 @item _CS_PATH
1599 This parameter's value is the recommended default path for searching for
1600 executable files.  This is the path that a user has by default just
1601 after logging in.
1603 @comment unistd.h
1604 @comment Unix98
1605 @item _CS_LFS_CFLAGS
1606 The returned string specifies which additional flags must be given to
1607 the C compiler if a source is compiled using the
1608 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1610 @comment unistd.h
1611 @comment Unix98
1612 @item _CS_LFS_LDFLAGS
1613 The returned string specifies which additional flags must be given to
1614 the linker if a source is compiled using the
1615 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1617 @comment unistd.h
1618 @comment Unix98
1619 @item _CS_LFS_LIBS
1620 The returned string specifies which additional libraries must be linked
1621 to the application if a source is compiled using the
1622 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1624 @comment unistd.h
1625 @comment Unix98
1626 @item _CS_LFS_LINTFLAGS
1627 The returned string specifies which additional flags must be given to
1628 the lint tool if a source is compiled using the
1629 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1631 @comment unistd.h
1632 @comment Unix98
1633 @item _CS_LFS64_CFLAGS
1634 The returned string specifies which additional flags must be given to
1635 the C compiler if a source is compiled using the
1636 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1638 @comment unistd.h
1639 @comment Unix98
1640 @item _CS_LFS64_LDFLAGS
1641 The returned string specifies which additional flags must be given to
1642 the linker if a source is compiled using the
1643 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1645 @comment unistd.h
1646 @comment Unix98
1647 @item _CS_LFS64_LIBS
1648 The returned string specifies which additional libraries must be linked
1649 to the application if a source is compiled using the
1650 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1652 @comment unistd.h
1653 @comment Unix98
1654 @item _CS_LFS64_LINTFLAGS
1655 The returned string specifies which additional flags must be given to
1656 the lint tool if a source is compiled using the
1657 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1658 @end table
1660 The way to use @code{confstr} without any arbitrary limit on string size
1661 is to call it twice: first call it to get the length, allocate the
1662 buffer accordingly, and then call @code{confstr} again to fill the
1663 buffer, like this:
1665 @smallexample
1666 @group
1667 char *
1668 get_default_path (void)
1670   size_t len = confstr (_CS_PATH, NULL, 0);
1671   char *buffer = (char *) xmalloc (len);
1673   if (confstr (_CS_PATH, buf, len + 1) == 0)
1674     @{
1675       free (buffer);
1676       return NULL;
1677     @}
1679   return buffer;
1681 @end group
1682 @end smallexample