powerpc: refactor strcasestr and strstr IFUNC.
[glibc.git] / manual / conf.texi
blob1fe75c293f59ba278a873f33159ddc2bf1e65553
1 @node System Configuration, Cryptographic Functions, System Management, Top
2 @c %MENU% Parameters describing operating system limits
3 @chapter System Configuration Parameters
5 The functions and macros listed in this chapter give information about
6 configuration parameters of the operating system---for example, capacity
7 limits, presence of optional POSIX features, and the default path for
8 executable files (@pxref{String Parameters}).
10 @menu
11 * General Limits::           Constants and functions that describe
12                                 various process-related limits that have
13                                 one uniform value for any given machine.
14 * System Options::           Optional POSIX features.
15 * Version Supported::        Version numbers of POSIX.1 and POSIX.2.
16 * Sysconf::                  Getting specific configuration values
17                                 of general limits and system options.
18 * Minimums::                 Minimum values for general limits.
20 * Limits for Files::         Size limitations that pertain to individual files.
21                                 These can vary between file systems
22                                 or even from file to file.
23 * Options for Files::        Optional features that some files may support.
24 * File Minimums::            Minimum values for file limits.
25 * Pathconf::                 Getting the limit values for a particular file.
27 * Utility Limits::           Capacity limits of some POSIX.2 utility programs.
28 * Utility Minimums::         Minimum allowable values of those limits.
30 * String Parameters::        Getting the default search path.
31 @end menu
33 @node General Limits
34 @section General Capacity Limits
35 @cindex POSIX capacity limits
36 @cindex limits, POSIX
37 @cindex capacity limits, POSIX
39 The POSIX.1 and POSIX.2 standards specify a number of parameters that
40 describe capacity limitations of the system.  These limits can be fixed
41 constants for a given operating system, or they can vary from machine to
42 machine.  For example, some limit values may be configurable by the
43 system administrator, either at run time or by rebuilding the kernel,
44 and this should not require recompiling application programs.
46 @pindex limits.h
47 Each of the following limit parameters has a macro that is defined in
48 @file{limits.h} only if the system has a fixed, uniform limit for the
49 parameter in question.  If the system allows different file systems or
50 files to have different limits, then the macro is undefined; use
51 @code{sysconf} to find out the limit that applies at a particular time
52 on a particular machine.  @xref{Sysconf}.
54 Each of these parameters also has another macro, with a name starting
55 with @samp{_POSIX}, which gives the lowest value that the limit is
56 allowed to have on @emph{any} POSIX system.  @xref{Minimums}.
58 @cindex limits, program argument size
59 @comment limits.h
60 @comment POSIX.1
61 @deftypevr Macro int ARG_MAX
62 If defined, the unvarying maximum combined length of the @var{argv} and
63 @var{environ} arguments that can be passed to the @code{exec} functions.
64 @end deftypevr
66 @cindex limits, number of processes
67 @comment limits.h
68 @comment POSIX.1
69 @deftypevr Macro int CHILD_MAX
70 If defined, the unvarying maximum number of processes that can exist
71 with the same real user ID at any one time.  In BSD and GNU, this is
72 controlled by the @code{RLIMIT_NPROC} resource limit; @pxref{Limits on
73 Resources}.
74 @end deftypevr
76 @cindex limits, number of open files
77 @comment limits.h
78 @comment POSIX.1
79 @deftypevr Macro int OPEN_MAX
80 If defined, the unvarying maximum number of files that a single process
81 can have open simultaneously.  In BSD and GNU, this is controlled
82 by the @code{RLIMIT_NOFILE} resource limit; @pxref{Limits on Resources}.
83 @end deftypevr
85 @comment limits.h
86 @comment POSIX.1
87 @deftypevr Macro int STREAM_MAX
88 If defined, the unvarying maximum number of streams that a single
89 process can have open simultaneously.  @xref{Opening Streams}.
90 @end deftypevr
92 @cindex limits, time zone name length
93 @comment limits.h
94 @comment POSIX.1
95 @deftypevr Macro int TZNAME_MAX
96 If defined, the unvarying maximum length of a time zone name.
97 @xref{Time Zone Functions}.
98 @end deftypevr
100 These limit macros are always defined in @file{limits.h}.
102 @cindex limits, number of supplementary group IDs
103 @comment limits.h
104 @comment POSIX.1
105 @deftypevr Macro int NGROUPS_MAX
106 The maximum number of supplementary group IDs that one process can have.
108 The value of this macro is actually a lower bound for the maximum.  That
109 is, you can count on being able to have that many supplementary group
110 IDs, but a particular machine might let you have even more.  You can use
111 @code{sysconf} to see whether a particular machine will let you have
112 more (@pxref{Sysconf}).
113 @end deftypevr
115 @comment limits.h
116 @comment POSIX.1
117 @deftypevr Macro ssize_t SSIZE_MAX
118 The largest value that can fit in an object of type @code{ssize_t}.
119 Effectively, this is the limit on the number of bytes that can be read
120 or written in a single operation.
122 This macro is defined in all POSIX systems because this limit is never
123 configurable.
124 @end deftypevr
126 @comment limits.h
127 @comment POSIX.2
128 @deftypevr Macro int RE_DUP_MAX
129 The largest number of repetitions you are guaranteed is allowed in the
130 construct @samp{\@{@var{min},@var{max}\@}} in a regular expression.
132 The value of this macro is actually a lower bound for the maximum.  That
133 is, you can count on being able to have that many repetitions, but a
134 particular machine might let you have even more.  You can use
135 @code{sysconf} to see whether a particular machine will let you have
136 more (@pxref{Sysconf}).  And even the value that @code{sysconf} tells
137 you is just a lower bound---larger values might work.
139 This macro is defined in all POSIX.2 systems, because POSIX.2 says it
140 should always be defined even if there is no specific imposed limit.
141 @end deftypevr
143 @node System Options
144 @section Overall System Options
145 @cindex POSIX optional features
146 @cindex optional POSIX features
148 POSIX defines certain system-specific options that not all POSIX systems
149 support.  Since these options are provided in the kernel, not in the
150 library, simply using @theglibc{} does not guarantee any of these
151 features are supported; it depends on the system you are using.
153 @pindex unistd.h
154 You can test for the availability of a given option using the macros in
155 this section, together with the function @code{sysconf}.  The macros are
156 defined only if you include @file{unistd.h}.
158 For the following macros, if the macro is defined in @file{unistd.h},
159 then the option is supported.  Otherwise, the option may or may not be
160 supported; use @code{sysconf} to find out.  @xref{Sysconf}.
162 @comment unistd.h
163 @comment POSIX.1
164 @deftypevr Macro int _POSIX_JOB_CONTROL
165 If this symbol is defined, it indicates that the system supports job
166 control.  Otherwise, the implementation behaves as if all processes
167 within a session belong to a single process group.  @xref{Job Control}.
168 @end deftypevr
170 @comment unistd.h
171 @comment POSIX.1
172 @deftypevr Macro int _POSIX_SAVED_IDS
173 If this symbol is defined, it indicates that the system remembers the
174 effective user and group IDs of a process before it executes an
175 executable file with the set-user-ID or set-group-ID bits set, and that
176 explicitly changing the effective user or group IDs back to these values
177 is permitted.  If this option is not defined, then if a nonprivileged
178 process changes its effective user or group ID to the real user or group
179 ID of the process, it can't change it back again.  @xref{Enable/Disable
180 Setuid}.
181 @end deftypevr
183 For the following macros, if the macro is defined in @file{unistd.h},
184 then its value indicates whether the option is supported.  A value of
185 @code{-1} means no, and any other value means yes.  If the macro is not
186 defined, then the option may or may not be supported; use @code{sysconf}
187 to find out.  @xref{Sysconf}.
189 @comment unistd.h
190 @comment POSIX.2
191 @deftypevr Macro int _POSIX2_C_DEV
192 If this symbol is defined, it indicates that the system has the POSIX.2
193 C compiler command, @code{c89}.  @Theglibc{} always defines this
194 as @code{1}, on the assumption that you would not have installed it if
195 you didn't have a C compiler.
196 @end deftypevr
198 @comment unistd.h
199 @comment POSIX.2
200 @deftypevr Macro int _POSIX2_FORT_DEV
201 If this symbol is defined, it indicates that the system has the POSIX.2
202 Fortran compiler command, @code{fort77}.  @Theglibc{} never
203 defines this, because we don't know what the system has.
204 @end deftypevr
206 @comment unistd.h
207 @comment POSIX.2
208 @deftypevr Macro int _POSIX2_FORT_RUN
209 If this symbol is defined, it indicates that the system has the POSIX.2
210 @code{asa} command to interpret Fortran carriage control.  @Theglibc{}
211 never defines this, because we don't know what the system has.
212 @end deftypevr
214 @comment unistd.h
215 @comment POSIX.2
216 @deftypevr Macro int _POSIX2_LOCALEDEF
217 If this symbol is defined, it indicates that the system has the POSIX.2
218 @code{localedef} command.  @Theglibc{} never defines this, because
219 we don't know what the system has.
220 @end deftypevr
222 @comment unistd.h
223 @comment POSIX.2
224 @deftypevr Macro int _POSIX2_SW_DEV
225 If this symbol is defined, it indicates that the system has the POSIX.2
226 commands @code{ar}, @code{make}, and @code{strip}.  @Theglibc{}
227 always defines this as @code{1}, on the assumption that you had to have
228 @code{ar} and @code{make} to install the library, and it's unlikely that
229 @code{strip} would be absent when those are present.
230 @end deftypevr
232 @node Version Supported
233 @section Which Version of POSIX is Supported
235 @comment unistd.h
236 @comment POSIX.1
237 @deftypevr Macro {long int} _POSIX_VERSION
238 This constant represents the version of the POSIX.1 standard to which
239 the implementation conforms.  For an implementation conforming to the
240 1995 POSIX.1 standard, the value is the integer @code{199506L}.
242 @code{_POSIX_VERSION} is always defined (in @file{unistd.h}) in any
243 POSIX system.
245 @strong{Usage Note:} Don't try to test whether the system supports POSIX
246 by including @file{unistd.h} and then checking whether
247 @code{_POSIX_VERSION} is defined.  On a non-POSIX system, this will
248 probably fail because there is no @file{unistd.h}.  We do not know of
249 @emph{any} way you can reliably test at compilation time whether your
250 target system supports POSIX or whether @file{unistd.h} exists.
251 @end deftypevr
253 @comment unistd.h
254 @comment POSIX.2
255 @deftypevr Macro {long int} _POSIX2_C_VERSION
256 This constant represents the version of the POSIX.2 standard which the
257 library and system kernel support.  We don't know what value this will
258 be for the first version of the POSIX.2 standard, because the value is
259 based on the year and month in which the standard is officially adopted.
261 The value of this symbol says nothing about the utilities installed on
262 the system.
264 @strong{Usage Note:} You can use this macro to tell whether a POSIX.1
265 system library supports POSIX.2 as well.  Any POSIX.1 system contains
266 @file{unistd.h}, so include that file and then test @code{defined
267 (_POSIX2_C_VERSION)}.
268 @end deftypevr
270 @node Sysconf
271 @section Using @code{sysconf}
273 When your system has configurable system limits, you can use the
274 @code{sysconf} function to find out the value that applies to any
275 particular machine.  The function and the associated @var{parameter}
276 constants are declared in the header file @file{unistd.h}.
278 @menu
279 * Sysconf Definition::        Detailed specifications of @code{sysconf}.
280 * Constants for Sysconf::     The list of parameters @code{sysconf} can read.
281 * Examples of Sysconf::       How to use @code{sysconf} and the parameter
282                                  macros properly together.
283 @end menu
285 @node Sysconf Definition
286 @subsection Definition of @code{sysconf}
288 @comment unistd.h
289 @comment POSIX.1
290 @deftypefun {long int} sysconf (int @var{parameter})
291 @safety{@prelim{}@mtsafe{@mtsenv{}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{} @acsfd{}}}
292 @c Some parts of the implementation open /proc and /sys files and dirs
293 @c to collect system details, using fd and stream I/O depending on the
294 @c case.  The returned max value may change over time for NPROCS,
295 @c NPROCS_CONF, PHYS_PAGES, AVPHYS_PAGES, NGROUPS_MAX, SIGQUEUE_MAX,
296 @c depending on variable values read from /proc at each call, and from
297 @c rlimit-obtained values CHILD_MAX, OPEN_MAX, ARG_MAX, SIGQUEUE_MAX.
298 This function is used to inquire about runtime system parameters.  The
299 @var{parameter} argument should be one of the @samp{_SC_} symbols listed
300 below.
302 The normal return value from @code{sysconf} is the value you requested.
303 A value of @code{-1} is returned both if the implementation does not
304 impose a limit, and in case of an error.
306 The following @code{errno} error conditions are defined for this function:
308 @table @code
309 @item EINVAL
310 The value of the @var{parameter} is invalid.
311 @end table
312 @end deftypefun
314 @node Constants for Sysconf
315 @subsection Constants for @code{sysconf} Parameters
317 Here are the symbolic constants for use as the @var{parameter} argument
318 to @code{sysconf}.  The values are all integer constants (more
319 specifically, enumeration type values).
321 @vtable @code
322 @comment unistd.h
323 @comment POSIX.1
324 @item _SC_ARG_MAX
325 Inquire about the parameter corresponding to @code{ARG_MAX}.
327 @comment unistd.h
328 @comment POSIX.1
329 @item _SC_CHILD_MAX
330 Inquire about the parameter corresponding to @code{CHILD_MAX}.
332 @comment unistd.h
333 @comment POSIX.1
334 @item _SC_OPEN_MAX
335 Inquire about the parameter corresponding to @code{OPEN_MAX}.
337 @comment unistd.h
338 @comment POSIX.1
339 @item _SC_STREAM_MAX
340 Inquire about the parameter corresponding to @code{STREAM_MAX}.
342 @comment unistd.h
343 @comment POSIX.1
344 @item _SC_TZNAME_MAX
345 Inquire about the parameter corresponding to @code{TZNAME_MAX}.
347 @comment unistd.h
348 @comment POSIX.1
349 @item _SC_NGROUPS_MAX
350 Inquire about the parameter corresponding to @code{NGROUPS_MAX}.
352 @comment unistd.h
353 @comment POSIX.1
354 @item _SC_JOB_CONTROL
355 Inquire about the parameter corresponding to @code{_POSIX_JOB_CONTROL}.
357 @comment unistd.h
358 @comment POSIX.1
359 @item _SC_SAVED_IDS
360 Inquire about the parameter corresponding to @code{_POSIX_SAVED_IDS}.
362 @comment unistd.h
363 @comment POSIX.1
364 @item _SC_VERSION
365 Inquire about the parameter corresponding to @code{_POSIX_VERSION}.
367 @comment unistd.h
368 @comment POSIX.1
369 @item _SC_CLK_TCK
370 Inquire about the number of clock ticks per second; @pxref{CPU Time}.
371 The corresponding parameter @code{CLK_TCK} is obsolete.
373 @comment unistd.h
374 @comment GNU
375 @item _SC_CHARCLASS_NAME_MAX
376 Inquire about the parameter corresponding to maximal length allowed for
377 a character class name in an extended locale specification.  These
378 extensions are not yet standardized and so this option is not standardized
379 as well.
381 @comment unistdh.h
382 @comment POSIX.1
383 @item _SC_REALTIME_SIGNALS
384 Inquire about the parameter corresponding to @code{_POSIX_REALTIME_SIGNALS}.
386 @comment unistd.h
387 @comment POSIX.1
388 @item _SC_PRIORITY_SCHEDULING
389 Inquire about the parameter corresponding to @code{_POSIX_PRIORITY_SCHEDULING}.
391 @comment unistd.h
392 @comment POSIX.1
393 @item _SC_TIMERS
394 Inquire about the parameter corresponding to @code{_POSIX_TIMERS}.
396 @comment unistd.h
397 @comment POSIX.1
398 @item _SC_ASYNCHRONOUS_IO
399 Inquire about the parameter corresponding to @code{_POSIX_ASYNCHRONOUS_IO}.
401 @comment unistd.h
402 @comment POSIX.1
403 @item _SC_PRIORITIZED_IO
404 Inquire about the parameter corresponding to @code{_POSIX_PRIORITIZED_IO}.
406 @comment unistd.h
407 @comment POSIX.1
408 @item _SC_SYNCHRONIZED_IO
409 Inquire about the parameter corresponding to @code{_POSIX_SYNCHRONIZED_IO}.
411 @comment unistd.h
412 @comment POSIX.1
413 @item _SC_FSYNC
414 Inquire about the parameter corresponding to @code{_POSIX_FSYNC}.
416 @comment unistd.h
417 @comment POSIX.1
418 @item _SC_MAPPED_FILES
419 Inquire about the parameter corresponding to @code{_POSIX_MAPPED_FILES}.
421 @comment unistd.h
422 @comment POSIX.1
423 @item _SC_MEMLOCK
424 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK}.
426 @comment unistd.h
427 @comment POSIX.1
428 @item _SC_MEMLOCK_RANGE
429 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK_RANGE}.
431 @comment unistd.h
432 @comment POSIX.1
433 @item _SC_MEMORY_PROTECTION
434 Inquire about the parameter corresponding to @code{_POSIX_MEMORY_PROTECTION}.
436 @comment unistd.h
437 @comment POSIX.1
438 @item _SC_MESSAGE_PASSING
439 Inquire about the parameter corresponding to @code{_POSIX_MESSAGE_PASSING}.
441 @comment unistd.h
442 @comment POSIX.1
443 @item _SC_SEMAPHORES
444 Inquire about the parameter corresponding to @code{_POSIX_SEMAPHORES}.
446 @comment unistd.h
447 @comment POSIX.1
448 @item _SC_SHARED_MEMORY_OBJECTS
449 Inquire about the parameter corresponding to@*
450 @code{_POSIX_SHARED_MEMORY_OBJECTS}.
452 @comment unistd.h
453 @comment POSIX.1
454 @item _SC_AIO_LISTIO_MAX
455 Inquire about the parameter corresponding to @code{_POSIX_AIO_LISTIO_MAX}.
457 @comment unistd.h
458 @comment POSIX.1
459 @item _SC_AIO_MAX
460 Inquire about the parameter corresponding to @code{_POSIX_AIO_MAX}.
462 @comment unistd.h
463 @comment POSIX.1
464 @item _SC_AIO_PRIO_DELTA_MAX
465 Inquire about the value by which a process can decrease its asynchronous I/O
466 priority level from its own scheduling priority.  This corresponds to the
467 run-time invariant value @code{AIO_PRIO_DELTA_MAX}.
469 @comment unistd.h
470 @comment POSIX.1
471 @item _SC_DELAYTIMER_MAX
472 Inquire about the parameter corresponding to @code{_POSIX_DELAYTIMER_MAX}.
474 @comment unistd.h
475 @comment POSIX.1
476 @item _SC_MQ_OPEN_MAX
477 Inquire about the parameter corresponding to @code{_POSIX_MQ_OPEN_MAX}.
479 @comment unistd.h
480 @comment POSIX.1
481 @item _SC_MQ_PRIO_MAX
482 Inquire about the parameter corresponding to @code{_POSIX_MQ_PRIO_MAX}.
484 @comment unistd.h
485 @comment POSIX.1
486 @item _SC_RTSIG_MAX
487 Inquire about the parameter corresponding to @code{_POSIX_RTSIG_MAX}.
489 @comment unistd.h
490 @comment POSIX.1
491 @item _SC_SEM_NSEMS_MAX
492 Inquire about the parameter corresponding to @code{_POSIX_SEM_NSEMS_MAX}.
494 @comment unistd.h
495 @comment POSIX.1
496 @item _SC_SEM_VALUE_MAX
497 Inquire about the parameter corresponding to @code{_POSIX_SEM_VALUE_MAX}.
499 @comment unistd.h
500 @comment POSIX.1
501 @item _SC_SIGQUEUE_MAX
502 Inquire about the parameter corresponding to @code{_POSIX_SIGQUEUE_MAX}.
504 @comment unistd.h
505 @comment POSIX.1
506 @item _SC_TIMER_MAX
507 Inquire about the parameter corresponding to @code{_POSIX_TIMER_MAX}.
509 @comment unistd.h
510 @comment POSIX.1g
511 @item _SC_PII
512 Inquire about the parameter corresponding to @code{_POSIX_PII}.
514 @comment unistd.h
515 @comment POSIX.1g
516 @item _SC_PII_XTI
517 Inquire about the parameter corresponding to @code{_POSIX_PII_XTI}.
519 @comment unistd.h
520 @comment POSIX.1g
521 @item _SC_PII_SOCKET
522 Inquire about the parameter corresponding to @code{_POSIX_PII_SOCKET}.
524 @comment unistd.h
525 @comment POSIX.1g
526 @item _SC_PII_INTERNET
527 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET}.
529 @comment unistd.h
530 @comment POSIX.1g
531 @item _SC_PII_OSI
532 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI}.
534 @comment unistd.h
535 @comment POSIX.1g
536 @item _SC_SELECT
537 Inquire about the parameter corresponding to @code{_POSIX_SELECT}.
539 @comment unistd.h
540 @comment POSIX.1g
541 @item _SC_UIO_MAXIOV
542 Inquire about the parameter corresponding to @code{_POSIX_UIO_MAXIOV}.
544 @comment unistd.h
545 @comment POSIX.1g
546 @item _SC_PII_INTERNET_STREAM
547 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_STREAM}.
549 @comment unistd.h
550 @comment POSIX.1g
551 @item _SC_PII_INTERNET_DGRAM
552 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_DGRAM}.
554 @comment unistd.h
555 @comment POSIX.1g
556 @item _SC_PII_OSI_COTS
557 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_COTS}.
559 @comment unistd.h
560 @comment POSIX.1g
561 @item _SC_PII_OSI_CLTS
562 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_CLTS}.
564 @comment unistd.h
565 @comment POSIX.1g
566 @item _SC_PII_OSI_M
567 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_M}.
569 @comment unistd.h
570 @comment POSIX.1g
571 @item _SC_T_IOV_MAX
572 Inquire about the value associated with the @code{T_IOV_MAX}
573 variable.
575 @comment unistd.h
576 @comment POSIX.1
577 @item _SC_THREADS
578 Inquire about the parameter corresponding to @code{_POSIX_THREADS}.
580 @comment unistd.h
581 @comment POSIX.1
582 @item _SC_THREAD_SAFE_FUNCTIONS
583 Inquire about the parameter corresponding to@*
584 @code{_POSIX_THREAD_SAFE_FUNCTIONS}.
586 @comment unistd.h
587 @comment POSIX.1
588 @item _SC_GETGR_R_SIZE_MAX
589 Inquire about the parameter corresponding to @code{_POSIX_GETGR_R_SIZE_MAX}.
591 @comment unistd.h
592 @comment POSIX.1
593 @item _SC_GETPW_R_SIZE_MAX
594 Inquire about the parameter corresponding to @code{_POSIX_GETPW_R_SIZE_MAX}.
596 @comment unistd.h
597 @comment POSIX.1
598 @item _SC_LOGIN_NAME_MAX
599 Inquire about the parameter corresponding to @code{_POSIX_LOGIN_NAME_MAX}.
601 @comment unistd.h
602 @comment POSIX.1
603 @item _SC_TTY_NAME_MAX
604 Inquire about the parameter corresponding to @code{_POSIX_TTY_NAME_MAX}.
606 @comment unistd.h
607 @comment POSIX.1
608 @item _SC_THREAD_DESTRUCTOR_ITERATIONS
609 Inquire about the parameter corresponding to
610 @code{_POSIX_THREAD_DESTRUCTOR_ITERATIONS}.
612 @comment unistd.h
613 @comment POSIX.1
614 @item _SC_THREAD_KEYS_MAX
615 Inquire about the parameter corresponding to @code{_POSIX_THREAD_KEYS_MAX}.
617 @comment unistd.h
618 @comment POSIX.1
619 @item _SC_THREAD_STACK_MIN
620 Inquire about the parameter corresponding to @code{_POSIX_THREAD_STACK_MIN}.
622 @comment unistd.h
623 @comment POSIX.1
624 @item _SC_THREAD_THREADS_MAX
625 Inquire about the parameter corresponding to @code{_POSIX_THREAD_THREADS_MAX}.
627 @comment unistd.h
628 @comment POSIX.1
629 @item _SC_THREAD_ATTR_STACKADDR
630 Inquire about the parameter corresponding to@*a
631 @code{_POSIX_THREAD_ATTR_STACKADDR}.
633 @comment unistd.h
634 @comment POSIX.1
635 @item _SC_THREAD_ATTR_STACKSIZE
636 Inquire about the parameter corresponding to@*
637 @code{_POSIX_THREAD_ATTR_STACKSIZE}.
639 @comment unistd.h
640 @comment POSIX.1
641 @item _SC_THREAD_PRIORITY_SCHEDULING
642 Inquire about the parameter corresponding to
643 @code{_POSIX_THREAD_PRIORITY_SCHEDULING}.
645 @comment unistd.h
646 @comment POSIX.1
647 @item _SC_THREAD_PRIO_INHERIT
648 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_INHERIT}.
650 @comment unistd.h
651 @comment POSIX.1
652 @item _SC_THREAD_PRIO_PROTECT
653 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_PROTECT}.
655 @comment unistd.h
656 @comment POSIX.1
657 @item _SC_THREAD_PROCESS_SHARED
658 Inquire about the parameter corresponding to
659 @code{_POSIX_THREAD_PROCESS_SHARED}.
661 @comment unistd.h
662 @comment POSIX.2
663 @item _SC_2_C_DEV
664 Inquire about whether the system has the POSIX.2 C compiler command,
665 @code{c89}.
667 @comment unistd.h
668 @comment POSIX.2
669 @item _SC_2_FORT_DEV
670 Inquire about whether the system has the POSIX.2 Fortran compiler
671 command, @code{fort77}.
673 @comment unistd.h
674 @comment POSIX.2
675 @item _SC_2_FORT_RUN
676 Inquire about whether the system has the POSIX.2 @code{asa} command to
677 interpret Fortran carriage control.
679 @comment unistd.h
680 @comment POSIX.2
681 @item _SC_2_LOCALEDEF
682 Inquire about whether the system has the POSIX.2 @code{localedef}
683 command.
685 @comment unistd.h
686 @comment POSIX.2
687 @item _SC_2_SW_DEV
688 Inquire about whether the system has the POSIX.2 commands @code{ar},
689 @code{make}, and @code{strip}.
691 @comment unistd.h
692 @comment POSIX.2
693 @item _SC_BC_BASE_MAX
694 Inquire about the maximum value of @code{obase} in the @code{bc}
695 utility.
697 @comment unistd.h
698 @comment POSIX.2
699 @item _SC_BC_DIM_MAX
700 Inquire about the maximum size of an array in the @code{bc}
701 utility.
703 @comment unistd.h
704 @comment POSIX.2
705 @item _SC_BC_SCALE_MAX
706 Inquire about the maximum value of @code{scale} in the @code{bc}
707 utility.
709 @comment unistd.h
710 @comment POSIX.2
711 @item _SC_BC_STRING_MAX
712 Inquire about the maximum size of a string constant in the
713 @code{bc} utility.
715 @comment unistd.h
716 @comment POSIX.2
717 @item _SC_COLL_WEIGHTS_MAX
718 Inquire about the maximum number of weights that can necessarily
719 be used in defining the collating sequence for a locale.
721 @comment unistd.h
722 @comment POSIX.2
723 @item _SC_EXPR_NEST_MAX
724 Inquire about the maximum number of expressions nested within
725 parentheses when using the @code{expr} utility.
727 @comment unistd.h
728 @comment POSIX.2
729 @item _SC_LINE_MAX
730 Inquire about the maximum size of a text line that the POSIX.2 text
731 utilities can handle.
733 @comment unistd.h
734 @comment POSIX.2
735 @item _SC_EQUIV_CLASS_MAX
736 Inquire about the maximum number of weights that can be assigned to an
737 entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale
738 definition.  @Theglibc{} does not presently support locale
739 definitions.
741 @comment unistd.h
742 @comment POSIX.2
743 @item _SC_VERSION
744 Inquire about the version number of POSIX.1 that the library and kernel
745 support.
747 @comment unistd.h
748 @comment POSIX.2
749 @item _SC_2_VERSION
750 Inquire about the version number of POSIX.2 that the system utilities
751 support.
753 @comment unistd.h
754 @comment GNU
755 @item _SC_PAGESIZE
756 Inquire about the virtual memory page size of the machine.
757 @code{getpagesize} returns the same value (@pxref{Query Memory Parameters}).
759 @comment unistd.h
760 @comment GNU
761 @item _SC_NPROCESSORS_CONF
762 Inquire about the number of configured processors.
764 @comment unistd.h
765 @comment GNU
766 @item _SC_NPROCESSORS_ONLN
767 Inquire about the number of processors online.
769 @comment unistd.h
770 @comment GNU
771 @item _SC_PHYS_PAGES
772 Inquire about the number of physical pages in the system.
774 @comment unistd.h
775 @comment GNU
776 @item _SC_AVPHYS_PAGES
777 Inquire about the number of available physical pages in the system.
779 @comment unistd.h
780 @comment GNU
781 @item _SC_ATEXIT_MAX
782 Inquire about the 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_REALTIME
803 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME}.
805 @comment unistd.h
806 @comment X/Open
807 @item _SC_XOPEN_REALTIME_THREADS
808 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME_THREADS}.
810 @comment unistd.h
811 @comment X/Open
812 @item _SC_XOPEN_LEGACY
813 Inquire about the parameter corresponding to @code{_XOPEN_LEGACY}.
815 @comment unistd.h
816 @comment X/Open
817 @item _SC_XOPEN_CRYPT
818 Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
820 @comment unistd.h
821 @comment X/Open
822 @item _SC_XOPEN_ENH_I18N
823 Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
825 @comment unistd.h
826 @comment X/Open
827 @item _SC_XOPEN_SHM
828 Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
830 @comment unistd.h
831 @comment X/Open
832 @item _SC_XOPEN_XPG2
833 Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
835 @comment unistd.h
836 @comment X/Open
837 @item _SC_XOPEN_XPG3
838 Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
840 @comment unistd.h
841 @comment X/Open
842 @item _SC_XOPEN_XPG4
843 Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
845 @comment unistd.h
846 @comment X/Open
847 @item _SC_CHAR_BIT
848 Inquire about the number of bits in a variable of type @code{char}.
850 @comment unistd.h
851 @comment X/Open
852 @item _SC_CHAR_MAX
853 Inquire about the maximum value which can be stored in a variable of type
854 @code{char}.
856 @comment unistd.h
857 @comment X/Open
858 @item _SC_CHAR_MIN
859 Inquire about the minimum value which can be stored in a variable of type
860 @code{char}.
862 @comment unistd.h
863 @comment X/Open
864 @item _SC_INT_MAX
865 Inquire about the maximum value which can be stored in a variable of type
866 @code{int}.
868 @comment unistd.h
869 @comment X/Open
870 @item _SC_INT_MIN
871 Inquire about the minimum value which can be stored in a variable of type
872 @code{int}.
874 @comment unistd.h
875 @comment X/Open
876 @item _SC_LONG_BIT
877 Inquire about the number of bits in a variable of type @code{long int}.
879 @comment unistd.h
880 @comment X/Open
881 @item _SC_WORD_BIT
882 Inquire about the number of bits in a variable of a register word.
884 @comment unistd.h
885 @comment X/Open
886 @item _SC_MB_LEN_MAX
887 Inquire about the maximum length of a multi-byte representation of a wide
888 character value.
890 @comment unistd.h
891 @comment X/Open
892 @item _SC_NZERO
893 Inquire about the value used to internally represent the zero priority level for
894 the process execution.
896 @comment unistd.h
897 @comment X/Open
898 @item SC_SSIZE_MAX
899 Inquire about the maximum value which can be stored in a variable of type
900 @code{ssize_t}.
902 @comment unistd.h
903 @comment X/Open
904 @item _SC_SCHAR_MAX
905 Inquire about the maximum value which can be stored in a variable of type
906 @code{signed char}.
908 @comment unistd.h
909 @comment X/Open
910 @item _SC_SCHAR_MIN
911 Inquire about the minimum value which can be stored in a variable of type
912 @code{signed char}.
914 @comment unistd.h
915 @comment X/Open
916 @item _SC_SHRT_MAX
917 Inquire about the maximum value which can be stored in a variable of type
918 @code{short int}.
920 @comment unistd.h
921 @comment X/Open
922 @item _SC_SHRT_MIN
923 Inquire about the minimum value which can be stored in a variable of type
924 @code{short int}.
926 @comment unistd.h
927 @comment X/Open
928 @item _SC_UCHAR_MAX
929 Inquire about the maximum value which can be stored in a variable of type
930 @code{unsigned char}.
932 @comment unistd.h
933 @comment X/Open
934 @item _SC_UINT_MAX
935 Inquire about the maximum value which can be stored in a variable of type
936 @code{unsigned int}.
938 @comment unistd.h
939 @comment X/Open
940 @item _SC_ULONG_MAX
941 Inquire about the maximum value which can be stored in a variable of type
942 @code{unsigned long int}.
944 @comment unistd.h
945 @comment X/Open
946 @item _SC_USHRT_MAX
947 Inquire about the maximum value which can be stored in a variable of type
948 @code{unsigned short int}.
950 @comment unistd.h
951 @comment X/Open
952 @item _SC_NL_ARGMAX
953 Inquire about the parameter corresponding to @code{NL_ARGMAX}.
955 @comment unistd.h
956 @comment X/Open
957 @item _SC_NL_LANGMAX
958 Inquire about the parameter corresponding to @code{NL_LANGMAX}.
960 @comment unistd.h
961 @comment X/Open
962 @item _SC_NL_MSGMAX
963 Inquire about the parameter corresponding to @code{NL_MSGMAX}.
965 @comment unistd.h
966 @comment X/Open
967 @item _SC_NL_NMAX
968 Inquire about  the parameter corresponding to @code{NL_NMAX}.
970 @comment unistd.h
971 @comment X/Open
972 @item _SC_NL_SETMAX
973 Inquire about the parameter corresponding to @code{NL_SETMAX}.
975 @comment unistd.h
976 @comment X/Open
977 @item _SC_NL_TEXTMAX
978 Inquire about the parameter corresponding to @code{NL_TEXTMAX}.
979 @end vtable
981 @node Examples of Sysconf
982 @subsection Examples of @code{sysconf}
984 We recommend that you first test for a macro definition for the
985 parameter you are interested in, and call @code{sysconf} only if the
986 macro is not defined.  For example, here is how to test whether job
987 control is supported:
989 @smallexample
990 @group
992 have_job_control (void)
994 #ifdef _POSIX_JOB_CONTROL
995   return 1;
996 #else
997   int value = sysconf (_SC_JOB_CONTROL);
998   if (value < 0)
999     /* @r{If the system is that badly wedged,}
1000        @r{there's no use trying to go on.}  */
1001     fatal (strerror (errno));
1002   return value;
1003 #endif
1005 @end group
1006 @end smallexample
1008 Here is how to get the value of a numeric limit:
1010 @smallexample
1012 get_child_max ()
1014 #ifdef CHILD_MAX
1015   return CHILD_MAX;
1016 #else
1017   int value = sysconf (_SC_CHILD_MAX);
1018   if (value < 0)
1019     fatal (strerror (errno));
1020   return value;
1021 #endif
1023 @end smallexample
1025 @node Minimums
1026 @section Minimum Values for General Capacity Limits
1028 Here are the names for the POSIX minimum upper bounds for the system
1029 limit parameters.  The significance of these values is that you can
1030 safely push to these limits without checking whether the particular
1031 system you are using can go that far.
1033 @table @code
1034 @comment limits.h
1035 @comment POSIX.1
1036 @item _POSIX_AIO_LISTIO_MAX
1037 The most restrictive limit permitted by POSIX for the maximum number of
1038 I/O operations that can be specified in a list I/O call.  The value of
1039 this constant is @code{2}; thus you can add up to two new entries
1040 of the list of outstanding operations.
1042 @comment limits.h
1043 @comment POSIX.1
1044 @item _POSIX_AIO_MAX
1045 The most restrictive limit permitted by POSIX for the maximum number of
1046 outstanding asynchronous I/O operations.  The value of this constant is
1047 @code{1}.  So you cannot expect that you can issue more than one
1048 operation and immediately continue with the normal work, receiving the
1049 notifications asynchronously.
1051 @comment limits.h
1052 @comment POSIX.1
1053 @item _POSIX_ARG_MAX
1054 The value of this macro is the most restrictive limit permitted by POSIX
1055 for the maximum combined length of the @var{argv} and @var{environ}
1056 arguments that can be passed to the @code{exec} functions.
1057 Its value is @code{4096}.
1059 @comment limits.h
1060 @comment POSIX.1
1061 @item _POSIX_CHILD_MAX
1062 The value of this macro is the most restrictive limit permitted by POSIX
1063 for the maximum number of simultaneous processes per real user ID.  Its
1064 value is @code{6}.
1066 @comment limits.h
1067 @comment POSIX.1
1068 @item _POSIX_NGROUPS_MAX
1069 The value of this macro is the most restrictive limit permitted by POSIX
1070 for the maximum number of supplementary group IDs per process.  Its
1071 value is @code{0}.
1073 @comment limits.h
1074 @comment POSIX.1
1075 @item _POSIX_OPEN_MAX
1076 The value of this macro is the most restrictive limit permitted by POSIX
1077 for the maximum number of files that a single process can have open
1078 simultaneously.  Its value is @code{16}.
1080 @comment limits.h
1081 @comment POSIX.1
1082 @item _POSIX_SSIZE_MAX
1083 The value of this macro is the most restrictive limit permitted by POSIX
1084 for the maximum value that can be stored in an object of type
1085 @code{ssize_t}.  Its value is @code{32767}.
1087 @comment limits.h
1088 @comment POSIX.1
1089 @item _POSIX_STREAM_MAX
1090 The value of this macro is the most restrictive limit permitted by POSIX
1091 for the maximum number of streams that a single process can have open
1092 simultaneously.  Its value is @code{8}.
1094 @comment limits.h
1095 @comment POSIX.1
1096 @item _POSIX_TZNAME_MAX
1097 The value of this macro is the most restrictive limit permitted by POSIX
1098 for the maximum length of a time zone name.  Its value is @code{3}.
1100 @comment limits.h
1101 @comment POSIX.2
1102 @item _POSIX2_RE_DUP_MAX
1103 The value of this macro is the most restrictive limit permitted by POSIX
1104 for the numbers used in the @samp{\@{@var{min},@var{max}\@}} construct
1105 in a regular expression.  Its value is @code{255}.
1106 @end table
1108 @node Limits for Files
1109 @section Limits on File System Capacity
1111 The POSIX.1 standard specifies a number of parameters that describe the
1112 limitations of the file system.  It's possible for the system to have a
1113 fixed, uniform limit for a parameter, but this isn't the usual case.  On
1114 most systems, it's possible for different file systems (and, for some
1115 parameters, even different files) to have different maximum limits.  For
1116 example, this is very likely if you use NFS to mount some of the file
1117 systems from other machines.
1119 @pindex limits.h
1120 Each of the following macros is defined in @file{limits.h} only if the
1121 system has a fixed, uniform limit for the parameter in question.  If the
1122 system allows different file systems or files to have different limits,
1123 then the macro is undefined; use @code{pathconf} or @code{fpathconf} to
1124 find out the limit that applies to a particular file.  @xref{Pathconf}.
1126 Each parameter also has another macro, with a name starting with
1127 @samp{_POSIX}, which gives the lowest value that the limit is allowed to
1128 have on @emph{any} POSIX system.  @xref{File Minimums}.
1130 @cindex limits, link count of files
1131 @comment limits.h (optional)
1132 @comment POSIX.1
1133 @deftypevr Macro int LINK_MAX
1134 The uniform system limit (if any) for the number of names for a given
1135 file.  @xref{Hard Links}.
1136 @end deftypevr
1138 @cindex limits, terminal input queue
1139 @comment limits.h
1140 @comment POSIX.1
1141 @deftypevr Macro int MAX_CANON
1142 The uniform system limit (if any) for the amount of text in a line of
1143 input when input editing is enabled.  @xref{Canonical or Not}.
1144 @end deftypevr
1146 @comment limits.h
1147 @comment POSIX.1
1148 @deftypevr Macro int MAX_INPUT
1149 The uniform system limit (if any) for the total number of characters
1150 typed ahead as input.  @xref{I/O Queues}.
1151 @end deftypevr
1153 @cindex limits, file name length
1154 @comment limits.h
1155 @comment POSIX.1
1156 @deftypevr Macro int NAME_MAX
1157 The uniform system limit (if any) for the length of a file name component, not
1158 including the terminating null character.
1160 @strong{Portability Note:} On some systems, @theglibc{} defines
1161 @code{NAME_MAX}, but does not actually enforce this limit.
1162 @end deftypevr
1164 @comment limits.h
1165 @comment POSIX.1
1166 @deftypevr Macro int PATH_MAX
1167 The uniform system limit (if any) for the length of an entire file name (that
1168 is, the argument given to system calls such as @code{open}), including the
1169 terminating null character.
1171 @strong{Portability Note:} @Theglibc{} does not enforce this limit
1172 even if @code{PATH_MAX} is defined.
1173 @end deftypevr
1175 @cindex limits, pipe buffer size
1176 @comment limits.h
1177 @comment POSIX.1
1178 @deftypevr Macro int PIPE_BUF
1179 The uniform system limit (if any) for the number of bytes that can be
1180 written atomically to a pipe.  If multiple processes are writing to the
1181 same pipe simultaneously, output from different processes might be
1182 interleaved in chunks of this size.  @xref{Pipes and FIFOs}.
1183 @end deftypevr
1185 These are alternative macro names for some of the same information.
1187 @comment dirent.h
1188 @comment BSD
1189 @deftypevr Macro int MAXNAMLEN
1190 This is the BSD name for @code{NAME_MAX}.  It is defined in
1191 @file{dirent.h}.
1192 @end deftypevr
1194 @comment stdio.h
1195 @comment ISO
1196 @deftypevr Macro int FILENAME_MAX
1197 The value of this macro is an integer constant expression that
1198 represents the maximum length of a file name string.  It is defined in
1199 @file{stdio.h}.
1201 Unlike @code{PATH_MAX}, this macro is defined even if there is no actual
1202 limit imposed.  In such a case, its value is typically a very large
1203 number.  @strong{This is always the case on @gnuhurdsystems{}.}
1205 @strong{Usage Note:} Don't use @code{FILENAME_MAX} as the size of an
1206 array in which to store a file name!  You can't possibly make an array
1207 that big!  Use dynamic allocation (@pxref{Memory Allocation}) instead.
1208 @end deftypevr
1210 @node Options for Files
1211 @section Optional Features in File Support
1213 POSIX defines certain system-specific options in the system calls for
1214 operating on files.  Some systems support these options and others do
1215 not.  Since these options are provided in the kernel, not in the
1216 library, simply using @theglibc{} does not guarantee that any of these
1217 features is supported; it depends on the system you are using.  They can
1218 also vary between file systems on a single machine.
1220 @pindex unistd.h
1221 This section describes the macros you can test to determine whether a
1222 particular option is supported on your machine.  If a given macro is
1223 defined in @file{unistd.h}, then its value says whether the
1224 corresponding feature is supported.  (A value of @code{-1} indicates no;
1225 any other value indicates yes.)  If the macro is undefined, it means
1226 particular files may or may not support the feature.
1228 Since all the machines that support @theglibc{} also support NFS,
1229 one can never make a general statement about whether all file systems
1230 support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC}
1231 features.  So these names are never defined as macros in @theglibc{}.
1233 @comment unistd.h
1234 @comment POSIX.1
1235 @deftypevr Macro int _POSIX_CHOWN_RESTRICTED
1236 If this option is in effect, the @code{chown} function is restricted so
1237 that the only changes permitted to nonprivileged processes is to change
1238 the group owner of a file to either be the effective group ID of the
1239 process, or one of its supplementary group IDs.  @xref{File Owner}.
1240 @end deftypevr
1242 @comment unistd.h
1243 @comment POSIX.1
1244 @deftypevr Macro int _POSIX_NO_TRUNC
1245 If this option is in effect, file name components longer than
1246 @code{NAME_MAX} generate an @code{ENAMETOOLONG} error.  Otherwise, file
1247 name components that are too long are silently truncated.
1248 @end deftypevr
1250 @comment unistd.h
1251 @comment POSIX.1
1252 @deftypevr Macro {unsigned char} _POSIX_VDISABLE
1253 This option is only meaningful for files that are terminal devices.
1254 If it is enabled, then handling for special control characters can
1255 be disabled individually.  @xref{Special Characters}.
1256 @end deftypevr
1258 @pindex unistd.h
1259 If one of these macros is undefined, that means that the option might be
1260 in effect for some files and not for others.  To inquire about a
1261 particular file, call @code{pathconf} or @code{fpathconf}.
1262 @xref{Pathconf}.
1264 @node File Minimums
1265 @section Minimum Values for File System Limits
1267 Here are the names for the POSIX minimum upper bounds for some of the
1268 above parameters.  The significance of these values is that you can
1269 safely push to these limits without checking whether the particular
1270 system you are using can go that far.  In most cases @gnusystems{} do not
1271 have these strict limitations.  The actual limit should be requested if
1272 necessary.
1274 @table @code
1275 @comment limits.h
1276 @comment POSIX.1
1277 @item _POSIX_LINK_MAX
1278 The most restrictive limit permitted by POSIX for the maximum value of a
1279 file's link count.  The value of this constant is @code{8}; thus, you
1280 can always make up to eight names for a file without running into a
1281 system limit.
1283 @comment limits.h
1284 @comment POSIX.1
1285 @item _POSIX_MAX_CANON
1286 The most restrictive limit permitted by POSIX for the maximum number of
1287 bytes in a canonical input line from a terminal device.  The value of
1288 this constant is @code{255}.
1290 @comment limits.h
1291 @comment POSIX.1
1292 @item _POSIX_MAX_INPUT
1293 The most restrictive limit permitted by POSIX for the maximum number of
1294 bytes in a terminal device input queue (or typeahead buffer).
1295 @xref{Input Modes}.  The value of this constant is @code{255}.
1297 @comment limits.h
1298 @comment POSIX.1
1299 @item _POSIX_NAME_MAX
1300 The most restrictive limit permitted by POSIX for the maximum number of
1301 bytes in a file name component.  The value of this constant is
1302 @code{14}.
1304 @comment limits.h
1305 @comment POSIX.1
1306 @item _POSIX_PATH_MAX
1307 The most restrictive limit permitted by POSIX for the maximum number of
1308 bytes in a file name.  The value of this constant is @code{256}.
1310 @comment limits.h
1311 @comment POSIX.1
1312 @item _POSIX_PIPE_BUF
1313 The most restrictive limit permitted by POSIX for the maximum number of
1314 bytes that can be written atomically to a pipe.  The value of this
1315 constant is @code{512}.
1317 @comment limits.h
1318 @comment POSIX.1
1319 @item SYMLINK_MAX
1320 Maximum number of bytes in a symbolic link.
1322 @comment limits.h
1323 @comment POSIX.1
1324 @item POSIX_REC_INCR_XFER_SIZE
1325 Recommended increment for file transfer sizes between the
1326 @code{POSIX_REC_MIN_XFER_SIZE} and @code{POSIX_REC_MAX_XFER_SIZE}
1327 values.
1329 @comment limits.h
1330 @comment POSIX.1
1331 @item POSIX_REC_MAX_XFER_SIZE
1332 Maximum recommended file transfer size.
1334 @comment limits.h
1335 @comment POSIX.1
1336 @item POSIX_REC_MIN_XFER_SIZE
1337 Minimum recommended file transfer size.
1339 @comment limits.h
1340 @comment POSIX.1
1341 @item POSIX_REC_XFER_ALIGN
1342 Recommended file transfer buffer alignment.
1343 @end table
1345 @node Pathconf
1346 @section Using @code{pathconf}
1348 When your machine allows different files to have different values for a
1349 file system parameter, you can use the functions in this section to find
1350 out the value that applies to any particular file.
1352 These functions and the associated constants for the @var{parameter}
1353 argument are declared in the header file @file{unistd.h}.
1355 @comment unistd.h
1356 @comment POSIX.1
1357 @deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})
1358 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1359 @c When __statfs_link_max finds an ext* filesystem, it may read
1360 @c /proc/mounts or similar as a mntent stream.
1361 @c __statfs_chown_restricted may read from
1362 @c /proc/sys/fs/xfs/restrict_chown as a file descriptor.
1363 This function is used to inquire about the limits that apply to
1364 the file named @var{filename}.
1366 The @var{parameter} argument should be one of the @samp{_PC_} constants
1367 listed below.
1369 The normal return value from @code{pathconf} is the value you requested.
1370 A value of @code{-1} is returned both if the implementation does not
1371 impose a limit, and in case of an error.  In the former case,
1372 @code{errno} is not set, while in the latter case, @code{errno} is set
1373 to indicate the cause of the problem.  So the only way to use this
1374 function robustly is to store @code{0} into @code{errno} just before
1375 calling it.
1377 Besides the usual file name errors (@pxref{File Name Errors}),
1378 the following error condition is defined for this function:
1380 @table @code
1381 @item EINVAL
1382 The value of @var{parameter} is invalid, or the implementation doesn't
1383 support the @var{parameter} for the specific file.
1384 @end table
1385 @end deftypefun
1387 @comment unistd.h
1388 @comment POSIX.1
1389 @deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})
1390 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1391 @c Same caveats as pathconf.
1392 This is just like @code{pathconf} except that an open file descriptor
1393 is used to specify the file for which information is requested, instead
1394 of a file name.
1396 The following @code{errno} error conditions are defined for this function:
1398 @table @code
1399 @item EBADF
1400 The @var{filedes} argument is not a valid file descriptor.
1402 @item EINVAL
1403 The value of @var{parameter} is invalid, or the implementation doesn't
1404 support the @var{parameter} for the specific file.
1405 @end table
1406 @end deftypefun
1408 Here are the symbolic constants that you can use as the @var{parameter}
1409 argument to @code{pathconf} and @code{fpathconf}.  The values are all
1410 integer constants.
1412 @table @code
1413 @comment unistd.h
1414 @comment POSIX.1
1415 @item _PC_LINK_MAX
1416 Inquire about the value of @code{LINK_MAX}.
1418 @comment unistd.h
1419 @comment POSIX.1
1420 @item _PC_MAX_CANON
1421 Inquire about the value of @code{MAX_CANON}.
1423 @comment unistd.h
1424 @comment POSIX.1
1425 @item _PC_MAX_INPUT
1426 Inquire about the value of @code{MAX_INPUT}.
1428 @comment unistd.h
1429 @comment POSIX.1
1430 @item _PC_NAME_MAX
1431 Inquire about the value of @code{NAME_MAX}.
1433 @comment unistd.h
1434 @comment POSIX.1
1435 @item _PC_PATH_MAX
1436 Inquire about the value of @code{PATH_MAX}.
1438 @comment unistd.h
1439 @comment POSIX.1
1440 @item _PC_PIPE_BUF
1441 Inquire about the value of @code{PIPE_BUF}.
1443 @comment unistd.h
1444 @comment POSIX.1
1445 @item _PC_CHOWN_RESTRICTED
1446 Inquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.
1448 @comment unistd.h
1449 @comment POSIX.1
1450 @item _PC_NO_TRUNC
1451 Inquire about the value of @code{_POSIX_NO_TRUNC}.
1453 @comment unistd.h
1454 @comment POSIX.1
1455 @item _PC_VDISABLE
1456 Inquire about the value of @code{_POSIX_VDISABLE}.
1458 @comment unistd.h
1459 @comment POSIX.1
1460 @item _PC_SYNC_IO
1461 Inquire about the value of @code{_POSIX_SYNC_IO}.
1463 @comment unistd.h
1464 @comment POSIX.1
1465 @item _PC_ASYNC_IO
1466 Inquire about the value of @code{_POSIX_ASYNC_IO}.
1468 @comment unistd.h
1469 @comment POSIX.1
1470 @item _PC_PRIO_IO
1471 Inquire about the value of @code{_POSIX_PRIO_IO}.
1473 @comment unistd.h
1474 @comment LFS
1475 @item _PC_FILESIZEBITS
1476 Inquire about the availability of large files on the filesystem.
1478 @comment unistd.h
1479 @comment POSIX.1
1480 @item _PC_REC_INCR_XFER_SIZE
1481 Inquire about the value of @code{POSIX_REC_INCR_XFER_SIZE}.
1483 @comment unistd.h
1484 @comment POSIX.1
1485 @item _PC_REC_MAX_XFER_SIZE
1486 Inquire about the value of @code{POSIX_REC_MAX_XFER_SIZE}.
1488 @comment unistd.h
1489 @comment POSIX.1
1490 @item _PC_REC_MIN_XFER_SIZE
1491 Inquire about the value of @code{POSIX_REC_MIN_XFER_SIZE}.
1493 @comment unistd.h
1494 @comment POSIX.1
1495 @item _PC_REC_XFER_ALIGN
1496 Inquire about the value of @code{POSIX_REC_XFER_ALIGN}.
1497 @end table
1499 @strong{Portability Note:} On some systems, @theglibc{} does not
1500 enforce @code{_PC_NAME_MAX} or @code{_PC_PATH_MAX} limits.
1502 @node Utility Limits
1503 @section Utility Program Capacity Limits
1505 The POSIX.2 standard specifies certain system limits that you can access
1506 through @code{sysconf} that apply to utility behavior rather than the
1507 behavior of the library or the operating system.
1509 @Theglibc{} defines macros for these limits, and @code{sysconf}
1510 returns values for them if you ask; but these values convey no
1511 meaningful information.  They are simply the smallest values that
1512 POSIX.2 permits.
1514 @comment limits.h
1515 @comment POSIX.2
1516 @deftypevr Macro int BC_BASE_MAX
1517 The largest value of @code{obase} that the @code{bc} utility is
1518 guaranteed to support.
1519 @end deftypevr
1521 @comment limits.h
1522 @comment POSIX.2
1523 @deftypevr Macro int BC_DIM_MAX
1524 The largest number of elements in one array that the @code{bc} utility
1525 is guaranteed to support.
1526 @end deftypevr
1528 @comment limits.h
1529 @comment POSIX.2
1530 @deftypevr Macro int BC_SCALE_MAX
1531 The largest value of @code{scale} that the @code{bc} utility is
1532 guaranteed to support.
1533 @end deftypevr
1535 @comment limits.h
1536 @comment POSIX.2
1537 @deftypevr Macro int BC_STRING_MAX
1538 The largest number of characters in one string constant that the
1539 @code{bc} utility is guaranteed to support.
1540 @end deftypevr
1542 @comment limits.h
1543 @comment POSIX.2
1544 @deftypevr Macro int COLL_WEIGHTS_MAX
1545 The largest number of weights that can necessarily be used in defining
1546 the collating sequence for a locale.
1547 @end deftypevr
1549 @comment limits.h
1550 @comment POSIX.2
1551 @deftypevr Macro int EXPR_NEST_MAX
1552 The maximum number of expressions that can be nested within parentheses
1553 by the @code{expr} utility.
1554 @end deftypevr
1556 @comment limits.h
1557 @comment POSIX.2
1558 @deftypevr Macro int LINE_MAX
1559 The largest text line that the text-oriented POSIX.2 utilities can
1560 support.  (If you are using the GNU versions of these utilities, then
1561 there is no actual limit except that imposed by the available virtual
1562 memory, but there is no way that the library can tell you this.)
1563 @end deftypevr
1565 @comment limits.h
1566 @comment POSIX.2
1567 @deftypevr Macro int EQUIV_CLASS_MAX
1568 The maximum number of weights that can be assigned to an entry of the
1569 @code{LC_COLLATE} category @samp{order} keyword in a locale definition.
1570 @Theglibc{} does not presently support locale definitions.
1571 @end deftypevr
1573 @node Utility Minimums
1574 @section Minimum Values for Utility Limits
1576 @table @code
1577 @comment limits.h
1578 @comment POSIX.2
1579 @item _POSIX2_BC_BASE_MAX
1580 The most restrictive limit permitted by POSIX.2 for the maximum value of
1581 @code{obase} in the @code{bc} utility.  Its value is @code{99}.
1583 @comment limits.h
1584 @comment POSIX.2
1585 @item _POSIX2_BC_DIM_MAX
1586 The most restrictive limit permitted by POSIX.2 for the maximum size of
1587 an array in the @code{bc} utility.  Its value is @code{2048}.
1589 @comment limits.h
1590 @comment POSIX.2
1591 @item _POSIX2_BC_SCALE_MAX
1592 The most restrictive limit permitted by POSIX.2 for the maximum value of
1593 @code{scale} in the @code{bc} utility.  Its value is @code{99}.
1595 @comment limits.h
1596 @comment POSIX.2
1597 @item _POSIX2_BC_STRING_MAX
1598 The most restrictive limit permitted by POSIX.2 for the maximum size of
1599 a string constant in the @code{bc} utility.  Its value is @code{1000}.
1601 @comment limits.h
1602 @comment POSIX.2
1603 @item _POSIX2_COLL_WEIGHTS_MAX
1604 The most restrictive limit permitted by POSIX.2 for the maximum number
1605 of weights that can necessarily be used in defining the collating
1606 sequence for a locale.  Its value is @code{2}.
1608 @comment limits.h
1609 @comment POSIX.2
1610 @item _POSIX2_EXPR_NEST_MAX
1611 The most restrictive limit permitted by POSIX.2 for the maximum number
1612 of expressions nested within parenthesis when using the @code{expr} utility.
1613 Its value is @code{32}.
1615 @comment limits.h
1616 @comment POSIX.2
1617 @item _POSIX2_LINE_MAX
1618 The most restrictive limit permitted by POSIX.2 for the maximum size of
1619 a text line that the text utilities can handle.  Its value is
1620 @code{2048}.
1622 @comment limits.h
1623 @comment POSIX.2
1624 @item _POSIX2_EQUIV_CLASS_MAX
1625 The most restrictive limit permitted by POSIX.2 for the maximum number
1626 of weights that can be assigned to an entry of the @code{LC_COLLATE}
1627 category @samp{order} keyword in a locale definition.  Its value is
1628 @code{2}.  @Theglibc{} does not presently support locale
1629 definitions.
1630 @end table
1632 @node String Parameters
1633 @section String-Valued Parameters
1635 POSIX.2 defines a way to get string-valued parameters from the operating
1636 system with the function @code{confstr}:
1638 @comment unistd.h
1639 @comment POSIX.2
1640 @deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})
1641 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
1642 This function reads the value of a string-valued system parameter,
1643 storing the string into @var{len} bytes of memory space starting at
1644 @var{buf}.  The @var{parameter} argument should be one of the
1645 @samp{_CS_} symbols listed below.
1647 The normal return value from @code{confstr} is the length of the string
1648 value that you asked for.  If you supply a null pointer for @var{buf},
1649 then @code{confstr} does not try to store the string; it just returns
1650 its length.  A value of @code{0} indicates an error.
1652 If the string you asked for is too long for the buffer (that is, longer
1653 than @code{@var{len} - 1}), then @code{confstr} stores just that much
1654 (leaving room for the terminating null character).  You can tell that
1655 this has happened because @code{confstr} returns a value greater than or
1656 equal to @var{len}.
1658 The following @code{errno} error conditions are defined for this function:
1660 @table @code
1661 @item EINVAL
1662 The value of the @var{parameter} is invalid.
1663 @end table
1664 @end deftypefun
1666 Currently there is just one parameter you can read with @code{confstr}:
1668 @table @code
1669 @comment unistd.h
1670 @comment POSIX.2
1671 @item _CS_PATH
1672 This parameter's value is the recommended default path for searching for
1673 executable files.  This is the path that a user has by default just
1674 after logging in.
1676 @comment unistd.h
1677 @comment Unix98
1678 @item _CS_LFS_CFLAGS
1679 The returned string specifies which additional flags must be given to
1680 the C compiler if a source is compiled using the
1681 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1683 @comment unistd.h
1684 @comment Unix98
1685 @item _CS_LFS_LDFLAGS
1686 The returned string specifies which additional flags must be given to
1687 the linker if a source is compiled using the
1688 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1690 @comment unistd.h
1691 @comment Unix98
1692 @item _CS_LFS_LIBS
1693 The returned string specifies which additional libraries must be linked
1694 to the application if a source is compiled using the
1695 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1697 @comment unistd.h
1698 @comment Unix98
1699 @item _CS_LFS_LINTFLAGS
1700 The returned string specifies which additional flags must be given to
1701 the lint tool if a source is compiled using the
1702 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1704 @comment unistd.h
1705 @comment Unix98
1706 @item _CS_LFS64_CFLAGS
1707 The returned string specifies which additional flags must be given to
1708 the C compiler if a source is compiled using the
1709 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1711 @comment unistd.h
1712 @comment Unix98
1713 @item _CS_LFS64_LDFLAGS
1714 The returned string specifies which additional flags must be given to
1715 the linker if a source is compiled using the
1716 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1718 @comment unistd.h
1719 @comment Unix98
1720 @item _CS_LFS64_LIBS
1721 The returned string specifies which additional libraries must be linked
1722 to the application if a source is compiled using the
1723 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1725 @comment unistd.h
1726 @comment Unix98
1727 @item _CS_LFS64_LINTFLAGS
1728 The returned string specifies which additional flags must be given to
1729 the lint tool if a source is compiled using the
1730 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1731 @end table
1733 The way to use @code{confstr} without any arbitrary limit on string size
1734 is to call it twice: first call it to get the length, allocate the
1735 buffer accordingly, and then call @code{confstr} again to fill the
1736 buffer, like this:
1738 @smallexample
1739 @group
1740 char *
1741 get_default_path (void)
1743   size_t len = confstr (_CS_PATH, NULL, 0);
1744   char *buffer = (char *) xmalloc (len);
1746   if (confstr (_CS_PATH, buf, len + 1) == 0)
1747     @{
1748       free (buffer);
1749       return NULL;
1750     @}
1752   return buffer;
1754 @end group
1755 @end smallexample