Sync "language", "lang_name", "territory", "country_name" with CLDR/langtable
[glibc.git] / manual / conf.texi
blobf959b00bb64abecfb95447aa7a5cb6a768d5b455
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 @deftypevr Macro int ARG_MAX
60 @standards{POSIX.1, limits.h}
61 If defined, the unvarying maximum combined length of the @var{argv} and
62 @var{environ} arguments that can be passed to the @code{exec} functions.
63 @end deftypevr
65 @cindex limits, number of processes
66 @deftypevr Macro int CHILD_MAX
67 @standards{POSIX.1, limits.h}
68 If defined, the unvarying maximum number of processes that can exist
69 with the same real user ID at any one time.  In BSD and GNU, this is
70 controlled by the @code{RLIMIT_NPROC} resource limit; @pxref{Limits on
71 Resources}.
72 @end deftypevr
74 @cindex limits, number of open files
75 @deftypevr Macro int OPEN_MAX
76 @standards{POSIX.1, limits.h}
77 If defined, the unvarying maximum number of files that a single process
78 can have open simultaneously.  In BSD and GNU, this is controlled
79 by the @code{RLIMIT_NOFILE} resource limit; @pxref{Limits on Resources}.
80 @end deftypevr
82 @deftypevr Macro int STREAM_MAX
83 @standards{POSIX.1, limits.h}
84 If defined, the unvarying maximum number of streams that a single
85 process can have open simultaneously.  @xref{Opening Streams}.
86 @end deftypevr
88 @cindex limits, time zone name length
89 @deftypevr Macro int TZNAME_MAX
90 @standards{POSIX.1, limits.h}
91 If defined, the unvarying maximum length of a time zone name.
92 @xref{Time Zone Functions}.
93 @end deftypevr
95 These limit macros are always defined in @file{limits.h}.
97 @cindex limits, number of supplementary group IDs
98 @deftypevr Macro int NGROUPS_MAX
99 @standards{POSIX.1, limits.h}
100 The maximum number of supplementary group IDs that one process can have.
102 The value of this macro is actually a lower bound for the maximum.  That
103 is, you can count on being able to have that many supplementary group
104 IDs, but a particular machine might let you have even more.  You can use
105 @code{sysconf} to see whether a particular machine will let you have
106 more (@pxref{Sysconf}).
107 @end deftypevr
109 @deftypevr Macro ssize_t SSIZE_MAX
110 @standards{POSIX.1, limits.h}
111 The largest value that can fit in an object of type @code{ssize_t}.
112 Effectively, this is the limit on the number of bytes that can be read
113 or written in a single operation.
115 This macro is defined in all POSIX systems because this limit is never
116 configurable.
117 @end deftypevr
119 @deftypevr Macro int RE_DUP_MAX
120 @standards{POSIX.2, limits.h}
121 The largest number of repetitions you are guaranteed is allowed in the
122 construct @samp{\@{@var{min},@var{max}\@}} in a regular expression.
124 The value of this macro is actually a lower bound for the maximum.  That
125 is, you can count on being able to have that many repetitions, but a
126 particular machine might let you have even more.  You can use
127 @code{sysconf} to see whether a particular machine will let you have
128 more (@pxref{Sysconf}).  And even the value that @code{sysconf} tells
129 you is just a lower bound---larger values might work.
131 This macro is defined in all POSIX.2 systems, because POSIX.2 says it
132 should always be defined even if there is no specific imposed limit.
133 @end deftypevr
135 @node System Options
136 @section Overall System Options
137 @cindex POSIX optional features
138 @cindex optional POSIX features
140 POSIX defines certain system-specific options that not all POSIX systems
141 support.  Since these options are provided in the kernel, not in the
142 library, simply using @theglibc{} does not guarantee any of these
143 features are supported; it depends on the system you are using.
145 @pindex unistd.h
146 You can test for the availability of a given option using the macros in
147 this section, together with the function @code{sysconf}.  The macros are
148 defined only if you include @file{unistd.h}.
150 For the following macros, if the macro is defined in @file{unistd.h},
151 then the option is supported.  Otherwise, the option may or may not be
152 supported; use @code{sysconf} to find out.  @xref{Sysconf}.
154 @deftypevr Macro int _POSIX_JOB_CONTROL
155 @standards{POSIX.1, unistd.h}
156 If this symbol is defined, it indicates that the system supports job
157 control.  Otherwise, the implementation behaves as if all processes
158 within a session belong to a single process group.  @xref{Job Control}.
159 Systems conforming to the 2001 revision of POSIX, or newer, will
160 always define this symbol.
161 @end deftypevr
163 @deftypevr Macro int _POSIX_SAVED_IDS
164 @standards{POSIX.1, unistd.h}
165 If this symbol is defined, it indicates that the system remembers the
166 effective user and group IDs of a process before it executes an
167 executable file with the set-user-ID or set-group-ID bits set, and that
168 explicitly changing the effective user or group IDs back to these values
169 is permitted.  If this option is not defined, then if a nonprivileged
170 process changes its effective user or group ID to the real user or group
171 ID of the process, it can't change it back again.  @xref{Enable/Disable
172 Setuid}.
173 @end deftypevr
175 For the following macros, if the macro is defined in @file{unistd.h},
176 then its value indicates whether the option is supported.  A value of
177 @code{-1} means no, and any other value means yes.  If the macro is not
178 defined, then the option may or may not be supported; use @code{sysconf}
179 to find out.  @xref{Sysconf}.
181 @deftypevr Macro int _POSIX2_C_DEV
182 @standards{POSIX.2, unistd.h}
183 If this symbol is defined, it indicates that the system has the POSIX.2
184 C compiler command, @code{c89}.  @Theglibc{} always defines this
185 as @code{1}, on the assumption that you would not have installed it if
186 you didn't have a C compiler.
187 @end deftypevr
189 @deftypevr Macro int _POSIX2_FORT_DEV
190 @standards{POSIX.2, unistd.h}
191 If this symbol is defined, it indicates that the system has the POSIX.2
192 Fortran compiler command, @code{fort77}.  @Theglibc{} never
193 defines this, because we don't know what the system has.
194 @end deftypevr
196 @deftypevr Macro int _POSIX2_FORT_RUN
197 @standards{POSIX.2, unistd.h}
198 If this symbol is defined, it indicates that the system has the POSIX.2
199 @code{asa} command to interpret Fortran carriage control.  @Theglibc{}
200 never defines this, because we don't know what the system has.
201 @end deftypevr
203 @deftypevr Macro int _POSIX2_LOCALEDEF
204 @standards{POSIX.2, unistd.h}
205 If this symbol is defined, it indicates that the system has the POSIX.2
206 @code{localedef} command.  @Theglibc{} never defines this, because
207 we don't know what the system has.
208 @end deftypevr
210 @deftypevr Macro int _POSIX2_SW_DEV
211 @standards{POSIX.2, unistd.h}
212 If this symbol is defined, it indicates that the system has the POSIX.2
213 commands @code{ar}, @code{make}, and @code{strip}.  @Theglibc{}
214 always defines this as @code{1}, on the assumption that you had to have
215 @code{ar} and @code{make} to install the library, and it's unlikely that
216 @code{strip} would be absent when those are present.
217 @end deftypevr
219 @node Version Supported
220 @section Which Version of POSIX is Supported
222 @deftypevr Macro {long int} _POSIX_VERSION
223 @standards{POSIX.1, unistd.h}
224 This constant represents the version of the POSIX.1 standard to which
225 the implementation conforms.  For an implementation conforming to the
226 1995 POSIX.1 standard, the value is the integer @code{199506L}.
228 @code{_POSIX_VERSION} is always defined (in @file{unistd.h}) in any
229 POSIX system.
231 @strong{Usage Note:} Don't try to test whether the system supports POSIX
232 by including @file{unistd.h} and then checking whether
233 @code{_POSIX_VERSION} is defined.  On a non-POSIX system, this will
234 probably fail because there is no @file{unistd.h}.  We do not know of
235 @emph{any} way you can reliably test at compilation time whether your
236 target system supports POSIX or whether @file{unistd.h} exists.
237 @end deftypevr
239 @deftypevr Macro {long int} _POSIX2_C_VERSION
240 @standards{POSIX.2, unistd.h}
241 This constant represents the version of the POSIX.2 standard which the
242 library and system kernel support.  We don't know what value this will
243 be for the first version of the POSIX.2 standard, because the value is
244 based on the year and month in which the standard is officially adopted.
246 The value of this symbol says nothing about the utilities installed on
247 the system.
249 @strong{Usage Note:} You can use this macro to tell whether a POSIX.1
250 system library supports POSIX.2 as well.  Any POSIX.1 system contains
251 @file{unistd.h}, so include that file and then test @code{defined
252 (_POSIX2_C_VERSION)}.
253 @end deftypevr
255 @node Sysconf
256 @section Using @code{sysconf}
258 When your system has configurable system limits, you can use the
259 @code{sysconf} function to find out the value that applies to any
260 particular machine.  The function and the associated @var{parameter}
261 constants are declared in the header file @file{unistd.h}.
263 @menu
264 * Sysconf Definition::        Detailed specifications of @code{sysconf}.
265 * Constants for Sysconf::     The list of parameters @code{sysconf} can read.
266 * Examples of Sysconf::       How to use @code{sysconf} and the parameter
267                                  macros properly together.
268 @end menu
270 @node Sysconf Definition
271 @subsection Definition of @code{sysconf}
273 @deftypefun {long int} sysconf (int @var{parameter})
274 @standards{POSIX.1, unistd.h}
275 @safety{@prelim{}@mtsafe{@mtsenv{}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{} @acsfd{}}}
276 @c Some parts of the implementation open /proc and /sys files and dirs
277 @c to collect system details, using fd and stream I/O depending on the
278 @c case.  The returned max value may change over time for NPROCS,
279 @c NPROCS_CONF, PHYS_PAGES, AVPHYS_PAGES, NGROUPS_MAX, SIGQUEUE_MAX,
280 @c depending on variable values read from /proc at each call, and from
281 @c rlimit-obtained values CHILD_MAX, OPEN_MAX, ARG_MAX, SIGQUEUE_MAX.
282 This function is used to inquire about runtime system parameters.  The
283 @var{parameter} argument should be one of the @samp{_SC_} symbols listed
284 below.
286 The normal return value from @code{sysconf} is the value you requested.
287 A value of @code{-1} is returned both if the implementation does not
288 impose a limit, and in case of an error.
290 The following @code{errno} error conditions are defined for this function:
292 @table @code
293 @item EINVAL
294 The value of the @var{parameter} is invalid.
295 @end table
296 @end deftypefun
298 @node Constants for Sysconf
299 @subsection Constants for @code{sysconf} Parameters
301 Here are the symbolic constants for use as the @var{parameter} argument
302 to @code{sysconf}.  The values are all integer constants (more
303 specifically, enumeration type values).
305 @vtable @code
306 @item _SC_ARG_MAX
307 @standards{POSIX.1, unistd.h}
308 Inquire about the parameter corresponding to @code{ARG_MAX}.
310 @item _SC_CHILD_MAX
311 @standards{POSIX.1, unistd.h}
312 Inquire about the parameter corresponding to @code{CHILD_MAX}.
314 @item _SC_OPEN_MAX
315 @standards{POSIX.1, unistd.h}
316 Inquire about the parameter corresponding to @code{OPEN_MAX}.
318 @item _SC_STREAM_MAX
319 @standards{POSIX.1, unistd.h}
320 Inquire about the parameter corresponding to @code{STREAM_MAX}.
322 @item _SC_TZNAME_MAX
323 @standards{POSIX.1, unistd.h}
324 Inquire about the parameter corresponding to @code{TZNAME_MAX}.
326 @item _SC_NGROUPS_MAX
327 @standards{POSIX.1, unistd.h}
328 Inquire about the parameter corresponding to @code{NGROUPS_MAX}.
330 @item _SC_JOB_CONTROL
331 @standards{POSIX.1, unistd.h}
332 Inquire about the parameter corresponding to @code{_POSIX_JOB_CONTROL}.
334 @item _SC_SAVED_IDS
335 @standards{POSIX.1, unistd.h}
336 Inquire about the parameter corresponding to @code{_POSIX_SAVED_IDS}.
338 @item _SC_VERSION
339 @standards{POSIX.1, unistd.h}
340 Inquire about the parameter corresponding to @code{_POSIX_VERSION}.
342 @item _SC_CLK_TCK
343 @standards{POSIX.1, unistd.h}
344 Inquire about the number of clock ticks per second; @pxref{CPU Time}.
345 The corresponding parameter @code{CLK_TCK} is obsolete.
347 @item _SC_CHARCLASS_NAME_MAX
348 @standards{GNU, unistd.h}
349 Inquire about the parameter corresponding to maximal length allowed for
350 a character class name in an extended locale specification.  These
351 extensions are not yet standardized and so this option is not standardized
352 as well.
354 @item _SC_REALTIME_SIGNALS
355 @standards{POSIX.1, unistdh.h}
356 Inquire about the parameter corresponding to @code{_POSIX_REALTIME_SIGNALS}.
358 @item _SC_PRIORITY_SCHEDULING
359 @standards{POSIX.1, unistd.h}
360 Inquire about the parameter corresponding to @code{_POSIX_PRIORITY_SCHEDULING}.
362 @item _SC_TIMERS
363 @standards{POSIX.1, unistd.h}
364 Inquire about the parameter corresponding to @code{_POSIX_TIMERS}.
366 @item _SC_ASYNCHRONOUS_IO
367 @standards{POSIX.1, unistd.h}
368 Inquire about the parameter corresponding to @code{_POSIX_ASYNCHRONOUS_IO}.
370 @item _SC_PRIORITIZED_IO
371 @standards{POSIX.1, unistd.h}
372 Inquire about the parameter corresponding to @code{_POSIX_PRIORITIZED_IO}.
374 @item _SC_SYNCHRONIZED_IO
375 @standards{POSIX.1, unistd.h}
376 Inquire about the parameter corresponding to @code{_POSIX_SYNCHRONIZED_IO}.
378 @item _SC_FSYNC
379 @standards{POSIX.1, unistd.h}
380 Inquire about the parameter corresponding to @code{_POSIX_FSYNC}.
382 @item _SC_MAPPED_FILES
383 @standards{POSIX.1, unistd.h}
384 Inquire about the parameter corresponding to @code{_POSIX_MAPPED_FILES}.
386 @item _SC_MEMLOCK
387 @standards{POSIX.1, unistd.h}
388 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK}.
390 @item _SC_MEMLOCK_RANGE
391 @standards{POSIX.1, unistd.h}
392 Inquire about the parameter corresponding to @code{_POSIX_MEMLOCK_RANGE}.
394 @item _SC_MEMORY_PROTECTION
395 @standards{POSIX.1, unistd.h}
396 Inquire about the parameter corresponding to @code{_POSIX_MEMORY_PROTECTION}.
398 @item _SC_MESSAGE_PASSING
399 @standards{POSIX.1, unistd.h}
400 Inquire about the parameter corresponding to @code{_POSIX_MESSAGE_PASSING}.
402 @item _SC_SEMAPHORES
403 @standards{POSIX.1, unistd.h}
404 Inquire about the parameter corresponding to @code{_POSIX_SEMAPHORES}.
406 @item _SC_SHARED_MEMORY_OBJECTS
407 @standards{POSIX.1, unistd.h}
408 Inquire about the parameter corresponding to@*
409 @code{_POSIX_SHARED_MEMORY_OBJECTS}.
411 @item _SC_AIO_LISTIO_MAX
412 @standards{POSIX.1, unistd.h}
413 Inquire about the parameter corresponding to @code{_POSIX_AIO_LISTIO_MAX}.
415 @item _SC_AIO_MAX
416 @standards{POSIX.1, unistd.h}
417 Inquire about the parameter corresponding to @code{_POSIX_AIO_MAX}.
419 @item _SC_AIO_PRIO_DELTA_MAX
420 @standards{POSIX.1, unistd.h}
421 Inquire about the value by which a process can decrease its asynchronous I/O
422 priority level from its own scheduling priority.  This corresponds to the
423 run-time invariant value @code{AIO_PRIO_DELTA_MAX}.
425 @item _SC_DELAYTIMER_MAX
426 @standards{POSIX.1, unistd.h}
427 Inquire about the parameter corresponding to @code{_POSIX_DELAYTIMER_MAX}.
429 @item _SC_MQ_OPEN_MAX
430 @standards{POSIX.1, unistd.h}
431 Inquire about the parameter corresponding to @code{_POSIX_MQ_OPEN_MAX}.
433 @item _SC_MQ_PRIO_MAX
434 @standards{POSIX.1, unistd.h}
435 Inquire about the parameter corresponding to @code{_POSIX_MQ_PRIO_MAX}.
437 @item _SC_RTSIG_MAX
438 @standards{POSIX.1, unistd.h}
439 Inquire about the parameter corresponding to @code{_POSIX_RTSIG_MAX}.
441 @item _SC_SEM_NSEMS_MAX
442 @standards{POSIX.1, unistd.h}
443 Inquire about the parameter corresponding to @code{_POSIX_SEM_NSEMS_MAX}.
445 @item _SC_SEM_VALUE_MAX
446 @standards{POSIX.1, unistd.h}
447 Inquire about the parameter corresponding to @code{_POSIX_SEM_VALUE_MAX}.
449 @item _SC_SIGQUEUE_MAX
450 @standards{POSIX.1, unistd.h}
451 Inquire about the parameter corresponding to @code{_POSIX_SIGQUEUE_MAX}.
453 @item _SC_TIMER_MAX
454 @standards{POSIX.1, unistd.h}
455 Inquire about the parameter corresponding to @code{_POSIX_TIMER_MAX}.
457 @item _SC_PII
458 @standards{POSIX.1g, unistd.h}
459 Inquire about the parameter corresponding to @code{_POSIX_PII}.
461 @item _SC_PII_XTI
462 @standards{POSIX.1g, unistd.h}
463 Inquire about the parameter corresponding to @code{_POSIX_PII_XTI}.
465 @item _SC_PII_SOCKET
466 @standards{POSIX.1g, unistd.h}
467 Inquire about the parameter corresponding to @code{_POSIX_PII_SOCKET}.
469 @item _SC_PII_INTERNET
470 @standards{POSIX.1g, unistd.h}
471 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET}.
473 @item _SC_PII_OSI
474 @standards{POSIX.1g, unistd.h}
475 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI}.
477 @item _SC_SELECT
478 @standards{POSIX.1g, unistd.h}
479 Inquire about the parameter corresponding to @code{_POSIX_SELECT}.
481 @item _SC_UIO_MAXIOV
482 @standards{POSIX.1g, unistd.h}
483 Inquire about the parameter corresponding to @code{_POSIX_UIO_MAXIOV}.
485 @item _SC_PII_INTERNET_STREAM
486 @standards{POSIX.1g, unistd.h}
487 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_STREAM}.
489 @item _SC_PII_INTERNET_DGRAM
490 @standards{POSIX.1g, unistd.h}
491 Inquire about the parameter corresponding to @code{_POSIX_PII_INTERNET_DGRAM}.
493 @item _SC_PII_OSI_COTS
494 @standards{POSIX.1g, unistd.h}
495 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_COTS}.
497 @item _SC_PII_OSI_CLTS
498 @standards{POSIX.1g, unistd.h}
499 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_CLTS}.
501 @item _SC_PII_OSI_M
502 @standards{POSIX.1g, unistd.h}
503 Inquire about the parameter corresponding to @code{_POSIX_PII_OSI_M}.
505 @item _SC_T_IOV_MAX
506 @standards{POSIX.1g, unistd.h}
507 Inquire about the value associated with the @code{T_IOV_MAX}
508 variable.
510 @item _SC_THREADS
511 @standards{POSIX.1, unistd.h}
512 Inquire about the parameter corresponding to @code{_POSIX_THREADS}.
514 @item _SC_THREAD_SAFE_FUNCTIONS
515 @standards{POSIX.1, unistd.h}
516 Inquire about the parameter corresponding to@*
517 @code{_POSIX_THREAD_SAFE_FUNCTIONS}.
519 @item _SC_GETGR_R_SIZE_MAX
520 @standards{POSIX.1, unistd.h}
521 Inquire about the parameter corresponding to @code{_POSIX_GETGR_R_SIZE_MAX}.
523 @item _SC_GETPW_R_SIZE_MAX
524 @standards{POSIX.1, unistd.h}
525 Inquire about the parameter corresponding to @code{_POSIX_GETPW_R_SIZE_MAX}.
527 @item _SC_LOGIN_NAME_MAX
528 @standards{POSIX.1, unistd.h}
529 Inquire about the parameter corresponding to @code{_POSIX_LOGIN_NAME_MAX}.
531 @item _SC_TTY_NAME_MAX
532 @standards{POSIX.1, unistd.h}
533 Inquire about the parameter corresponding to @code{_POSIX_TTY_NAME_MAX}.
535 @item _SC_THREAD_DESTRUCTOR_ITERATIONS
536 @standards{POSIX.1, unistd.h}
537 Inquire about the parameter corresponding to
538 @code{_POSIX_THREAD_DESTRUCTOR_ITERATIONS}.
540 @item _SC_THREAD_KEYS_MAX
541 @standards{POSIX.1, unistd.h}
542 Inquire about the parameter corresponding to @code{_POSIX_THREAD_KEYS_MAX}.
544 @item _SC_THREAD_STACK_MIN
545 @standards{POSIX.1, unistd.h}
546 Inquire about the parameter corresponding to @code{_POSIX_THREAD_STACK_MIN}.
548 @item _SC_THREAD_THREADS_MAX
549 @standards{POSIX.1, unistd.h}
550 Inquire about the parameter corresponding to @code{_POSIX_THREAD_THREADS_MAX}.
552 @item _SC_THREAD_ATTR_STACKADDR
553 @standards{POSIX.1, unistd.h}
554 Inquire about the parameter corresponding to@*a
555 @code{_POSIX_THREAD_ATTR_STACKADDR}.
557 @item _SC_THREAD_ATTR_STACKSIZE
558 @standards{POSIX.1, unistd.h}
559 Inquire about the parameter corresponding to@*
560 @code{_POSIX_THREAD_ATTR_STACKSIZE}.
562 @item _SC_THREAD_PRIORITY_SCHEDULING
563 @standards{POSIX.1, unistd.h}
564 Inquire about the parameter corresponding to
565 @code{_POSIX_THREAD_PRIORITY_SCHEDULING}.
567 @item _SC_THREAD_PRIO_INHERIT
568 @standards{POSIX.1, unistd.h}
569 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_INHERIT}.
571 @item _SC_THREAD_PRIO_PROTECT
572 @standards{POSIX.1, unistd.h}
573 Inquire about the parameter corresponding to @code{_POSIX_THREAD_PRIO_PROTECT}.
575 @item _SC_THREAD_PROCESS_SHARED
576 @standards{POSIX.1, unistd.h}
577 Inquire about the parameter corresponding to
578 @code{_POSIX_THREAD_PROCESS_SHARED}.
580 @item _SC_2_C_DEV
581 @standards{POSIX.2, unistd.h}
582 Inquire about whether the system has the POSIX.2 C compiler command,
583 @code{c89}.
585 @item _SC_2_FORT_DEV
586 @standards{POSIX.2, unistd.h}
587 Inquire about whether the system has the POSIX.2 Fortran compiler
588 command, @code{fort77}.
590 @item _SC_2_FORT_RUN
591 @standards{POSIX.2, unistd.h}
592 Inquire about whether the system has the POSIX.2 @code{asa} command to
593 interpret Fortran carriage control.
595 @item _SC_2_LOCALEDEF
596 @standards{POSIX.2, unistd.h}
597 Inquire about whether the system has the POSIX.2 @code{localedef}
598 command.
600 @item _SC_2_SW_DEV
601 @standards{POSIX.2, unistd.h}
602 Inquire about whether the system has the POSIX.2 commands @code{ar},
603 @code{make}, and @code{strip}.
605 @item _SC_BC_BASE_MAX
606 @standards{POSIX.2, unistd.h}
607 Inquire about the maximum value of @code{obase} in the @code{bc}
608 utility.
610 @item _SC_BC_DIM_MAX
611 @standards{POSIX.2, unistd.h}
612 Inquire about the maximum size of an array in the @code{bc}
613 utility.
615 @item _SC_BC_SCALE_MAX
616 @standards{POSIX.2, unistd.h}
617 Inquire about the maximum value of @code{scale} in the @code{bc}
618 utility.
620 @item _SC_BC_STRING_MAX
621 @standards{POSIX.2, unistd.h}
622 Inquire about the maximum size of a string constant in the
623 @code{bc} utility.
625 @item _SC_COLL_WEIGHTS_MAX
626 @standards{POSIX.2, unistd.h}
627 Inquire about the maximum number of weights that can necessarily
628 be used in defining the collating sequence for a locale.
630 @item _SC_EXPR_NEST_MAX
631 @standards{POSIX.2, unistd.h}
632 Inquire about the maximum number of expressions nested within
633 parentheses when using the @code{expr} utility.
635 @item _SC_LINE_MAX
636 @standards{POSIX.2, unistd.h}
637 Inquire about the maximum size of a text line that the POSIX.2 text
638 utilities can handle.
640 @item _SC_EQUIV_CLASS_MAX
641 @standards{POSIX.2, unistd.h}
642 Inquire about the maximum number of weights that can be assigned to an
643 entry of the @code{LC_COLLATE} category @samp{order} keyword in a locale
644 definition.  @Theglibc{} does not presently support locale
645 definitions.
647 @item _SC_VERSION
648 @standards{POSIX.2, unistd.h}
649 Inquire about the version number of POSIX.1 that the library and kernel
650 support.
652 @item _SC_2_VERSION
653 @standards{POSIX.2, unistd.h}
654 Inquire about the version number of POSIX.2 that the system utilities
655 support.
657 @item _SC_PAGESIZE
658 @standards{GNU, unistd.h}
659 Inquire about the virtual memory page size of the machine.
660 @code{getpagesize} returns the same value (@pxref{Query Memory Parameters}).
662 @item _SC_NPROCESSORS_CONF
663 @standards{GNU, unistd.h}
664 Inquire about the number of configured processors.
666 @item _SC_NPROCESSORS_ONLN
667 @standards{GNU, unistd.h}
668 Inquire about the number of processors online.
670 @item _SC_PHYS_PAGES
671 @standards{GNU, unistd.h}
672 Inquire about the number of physical pages in the system.
674 @item _SC_AVPHYS_PAGES
675 @standards{GNU, unistd.h}
676 Inquire about the number of available physical pages in the system.
678 @item _SC_ATEXIT_MAX
679 @standards{GNU, unistd.h}
680 Inquire about the number of functions which can be registered as termination
681 functions for @code{atexit}; @pxref{Cleanups on Exit}.
683 @item _SC_LEVEL1_ICACHE_SIZE
684 @standards{GNU, unistd.h}
685 Inquire about the size of the Level 1 instruction cache.
687 @item _SC_LEVEL1_ICACHE_ASSOC
688 @standards{GNU, unistd.h}
689 Inquire about the associativity of the Level 1 instruction cache.
691 @item _SC_LEVEL1_ICACHE_LINESIZE
692 @standards{GNU, unistd.h}
693 Inquire about the line length of the Level 1 instruction cache.
695 On aarch64, the cache line size returned is the minimum instruction cache line
696 size observable by userspace.  This is typically the same as the L1 icache
697 size but on some cores it may not be so.  However, it is specified in the
698 architecture that operations such as cache line invalidation are consistent
699 with the size reported with this variable.
701 @item _SC_LEVEL1_DCACHE_SIZE
702 @standards{GNU, unistd.h}
703 Inquire about the size of the Level 1 data cache.
705 @item _SC_LEVEL1_DCACHE_ASSOC
706 @standards{GNU, unistd.h}
707 Inquire about the associativity of the Level 1 data cache.
709 @item _SC_LEVEL1_DCACHE_LINESIZE
710 @standards{GNU, unistd.h}
711 Inquire about the line length of the Level 1 data cache.
713 On aarch64, the cache line size returned is the minimum data cache line size
714 observable by userspace.  This is typically the same as the L1 dcache size but
715 on some cores it may not be so.  However, it is specified in the architecture
716 that operations such as cache line invalidation are consistent with the size
717 reported with this variable.
719 @item _SC_LEVEL2_CACHE_SIZE
720 @standards{GNU, unistd.h}
721 Inquire about the size of the Level 2 cache.
723 @item _SC_LEVEL2_CACHE_ASSOC
724 @standards{GNU, unistd.h}
725 Inquire about the associativity of the Level 2 cache.
727 @item _SC_LEVEL2_CACHE_LINESIZE
728 @standards{GNU, unistd.h}
729 Inquire about the line length of the Level 2 cache.
731 @item _SC_LEVEL3_CACHE_SIZE
732 @standards{GNU, unistd.h}
733 Inquire about the size of the Level 3 cache.
735 @item _SC_LEVEL3_CACHE_ASSOC
736 @standards{GNU, unistd.h}
737 Inquire about the associativity of the Level 3 cache.
739 @item _SC_LEVEL3_CACHE_LINESIZE
740 @standards{GNU, unistd.h}
741 Inquire about the line length of the Level 3 cache.
743 @item _SC_LEVEL4_CACHE_SIZE
744 @standards{GNU, unistd.h}
745 Inquire about the size of the Level 4 cache.
747 @item _SC_LEVEL4_CACHE_ASSOC
748 @standards{GNU, unistd.h}
749 Inquire about the associativity of the Level 4 cache.
751 @item _SC_LEVEL4_CACHE_LINESIZE
752 @standards{GNU, unistd.h}
753 Inquire about the line length of the Level 4 cache.
756 @item _SC_XOPEN_VERSION
757 @standards{X/Open, unistd.h}
758 Inquire about the parameter corresponding to @code{_XOPEN_VERSION}.
760 @item _SC_XOPEN_XCU_VERSION
761 @standards{X/Open, unistd.h}
762 Inquire about the parameter corresponding to @code{_XOPEN_XCU_VERSION}.
764 @item _SC_XOPEN_UNIX
765 @standards{X/Open, unistd.h}
766 Inquire about the parameter corresponding to @code{_XOPEN_UNIX}.
768 @item _SC_XOPEN_REALTIME
769 @standards{X/Open, unistd.h}
770 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME}.
772 @item _SC_XOPEN_REALTIME_THREADS
773 @standards{X/Open, unistd.h}
774 Inquire about the parameter corresponding to @code{_XOPEN_REALTIME_THREADS}.
776 @item _SC_XOPEN_LEGACY
777 @standards{X/Open, unistd.h}
778 Inquire about the parameter corresponding to @code{_XOPEN_LEGACY}.
780 @item _SC_XOPEN_CRYPT
781 @standards{X/Open, unistd.h}
782 Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
783 @Theglibc no longer implements the @code{_XOPEN_CRYPT} extensions,
784 so @samp{sysconf (_SC_XOPEN_CRYPT)} always returns @code{-1}.
786 @item _SC_XOPEN_ENH_I18N
787 @standards{X/Open, unistd.h}
788 Inquire about the parameter corresponding to @code{_XOPEN_ENH_I18N}.
790 @item _SC_XOPEN_SHM
791 @standards{X/Open, unistd.h}
792 Inquire about the parameter corresponding to @code{_XOPEN_SHM}.
794 @item _SC_XOPEN_XPG2
795 @standards{X/Open, unistd.h}
796 Inquire about the parameter corresponding to @code{_XOPEN_XPG2}.
798 @item _SC_XOPEN_XPG3
799 @standards{X/Open, unistd.h}
800 Inquire about the parameter corresponding to @code{_XOPEN_XPG3}.
802 @item _SC_XOPEN_XPG4
803 @standards{X/Open, unistd.h}
804 Inquire about the parameter corresponding to @code{_XOPEN_XPG4}.
806 @item _SC_CHAR_BIT
807 @standards{X/Open, unistd.h}
808 Inquire about the number of bits in a variable of type @code{char}.
810 @item _SC_CHAR_MAX
811 @standards{X/Open, unistd.h}
812 Inquire about the maximum value which can be stored in a variable of type
813 @code{char}.
815 @item _SC_CHAR_MIN
816 @standards{X/Open, unistd.h}
817 Inquire about the minimum value which can be stored in a variable of type
818 @code{char}.
820 @item _SC_INT_MAX
821 @standards{X/Open, unistd.h}
822 Inquire about the maximum value which can be stored in a variable of type
823 @code{int}.
825 @item _SC_INT_MIN
826 @standards{X/Open, unistd.h}
827 Inquire about the minimum value which can be stored in a variable of type
828 @code{int}.
830 @item _SC_LONG_BIT
831 @standards{X/Open, unistd.h}
832 Inquire about the number of bits in a variable of type @code{long int}.
834 @item _SC_WORD_BIT
835 @standards{X/Open, unistd.h}
836 Inquire about the number of bits in a variable of a register word.
838 @item _SC_MB_LEN_MAX
839 @standards{X/Open, unistd.h}
840 Inquire about the maximum length of a multi-byte representation of a wide
841 character value.
843 @item _SC_NZERO
844 @standards{X/Open, unistd.h}
845 Inquire about the value used to internally represent the zero priority level for
846 the process execution.
848 @item _SC_SSIZE_MAX
849 @standards{X/Open, unistd.h}
850 Inquire about the maximum value which can be stored in a variable of type
851 @code{ssize_t}.
853 @item _SC_SCHAR_MAX
854 @standards{X/Open, unistd.h}
855 Inquire about the maximum value which can be stored in a variable of type
856 @code{signed char}.
858 @item _SC_SCHAR_MIN
859 @standards{X/Open, unistd.h}
860 Inquire about the minimum value which can be stored in a variable of type
861 @code{signed char}.
863 @item _SC_SHRT_MAX
864 @standards{X/Open, unistd.h}
865 Inquire about the maximum value which can be stored in a variable of type
866 @code{short int}.
868 @item _SC_SHRT_MIN
869 @standards{X/Open, unistd.h}
870 Inquire about the minimum value which can be stored in a variable of type
871 @code{short int}.
873 @item _SC_UCHAR_MAX
874 @standards{X/Open, unistd.h}
875 Inquire about the maximum value which can be stored in a variable of type
876 @code{unsigned char}.
878 @item _SC_UINT_MAX
879 @standards{X/Open, unistd.h}
880 Inquire about the maximum value which can be stored in a variable of type
881 @code{unsigned int}.
883 @item _SC_ULONG_MAX
884 @standards{X/Open, unistd.h}
885 Inquire about the maximum value which can be stored in a variable of type
886 @code{unsigned long int}.
888 @item _SC_USHRT_MAX
889 @standards{X/Open, unistd.h}
890 Inquire about the maximum value which can be stored in a variable of type
891 @code{unsigned short int}.
893 @item _SC_NL_ARGMAX
894 @standards{X/Open, unistd.h}
895 Inquire about the parameter corresponding to @code{NL_ARGMAX}.
897 @item _SC_NL_LANGMAX
898 @standards{X/Open, unistd.h}
899 Inquire about the parameter corresponding to @code{NL_LANGMAX}.
901 @item _SC_NL_MSGMAX
902 @standards{X/Open, unistd.h}
903 Inquire about the parameter corresponding to @code{NL_MSGMAX}.
905 @item _SC_NL_NMAX
906 @standards{X/Open, unistd.h}
907 Inquire about  the parameter corresponding to @code{NL_NMAX}.
909 @item _SC_NL_SETMAX
910 @standards{X/Open, unistd.h}
911 Inquire about the parameter corresponding to @code{NL_SETMAX}.
913 @item _SC_NL_TEXTMAX
914 @standards{X/Open, unistd.h}
915 Inquire about the parameter corresponding to @code{NL_TEXTMAX}.
916 @end vtable
918 @node Examples of Sysconf
919 @subsection Examples of @code{sysconf}
921 We recommend that you first test for a macro definition for the
922 parameter you are interested in, and call @code{sysconf} only if the
923 macro is not defined.  For example, here is how to test whether job
924 control is supported:
926 @smallexample
927 @group
929 have_job_control (void)
931 #ifdef _POSIX_JOB_CONTROL
932   return 1;
933 #else
934   int value = sysconf (_SC_JOB_CONTROL);
935   if (value < 0)
936     /* @r{If the system is that badly wedged,}
937        @r{there's no use trying to go on.}  */
938     fatal (strerror (errno));
939   return value;
940 #endif
942 @end group
943 @end smallexample
945 Here is how to get the value of a numeric limit:
947 @smallexample
949 get_child_max ()
951 #ifdef CHILD_MAX
952   return CHILD_MAX;
953 #else
954   int value = sysconf (_SC_CHILD_MAX);
955   if (value < 0)
956     fatal (strerror (errno));
957   return value;
958 #endif
960 @end smallexample
962 @node Minimums
963 @section Minimum Values for General Capacity Limits
965 Here are the names for the POSIX minimum upper bounds for the system
966 limit parameters.  The significance of these values is that you can
967 safely push to these limits without checking whether the particular
968 system you are using can go that far.
970 @vtable @code
971 @item _POSIX_AIO_LISTIO_MAX
972 @standards{POSIX.1, limits.h}
973 The most restrictive limit permitted by POSIX for the maximum number of
974 I/O operations that can be specified in a list I/O call.  The value of
975 this constant is @code{2}; thus you can add up to two new entries
976 of the list of outstanding operations.
978 @item _POSIX_AIO_MAX
979 @standards{POSIX.1, limits.h}
980 The most restrictive limit permitted by POSIX for the maximum number of
981 outstanding asynchronous I/O operations.  The value of this constant is
982 @code{1}.  So you cannot expect that you can issue more than one
983 operation and immediately continue with the normal work, receiving the
984 notifications asynchronously.
986 @item _POSIX_ARG_MAX
987 @standards{POSIX.1, limits.h}
988 The value of this macro is the most restrictive limit permitted by POSIX
989 for the maximum combined length of the @var{argv} and @var{environ}
990 arguments that can be passed to the @code{exec} functions.
991 Its value is @code{4096}.
993 @item _POSIX_CHILD_MAX
994 @standards{POSIX.1, limits.h}
995 The value of this macro is the most restrictive limit permitted by POSIX
996 for the maximum number of simultaneous processes per real user ID.  Its
997 value is @code{6}.
999 @item _POSIX_NGROUPS_MAX
1000 @standards{POSIX.1, limits.h}
1001 The value of this macro is the most restrictive limit permitted by POSIX
1002 for the maximum number of supplementary group IDs per process.  Its
1003 value is @code{0}.
1005 @item _POSIX_OPEN_MAX
1006 @standards{POSIX.1, limits.h}
1007 The value of this macro is the most restrictive limit permitted by POSIX
1008 for the maximum number of files that a single process can have open
1009 simultaneously.  Its value is @code{16}.
1011 @item _POSIX_SSIZE_MAX
1012 @standards{POSIX.1, limits.h}
1013 The value of this macro is the most restrictive limit permitted by POSIX
1014 for the maximum value that can be stored in an object of type
1015 @code{ssize_t}.  Its value is @code{32767}.
1017 @item _POSIX_STREAM_MAX
1018 @standards{POSIX.1, limits.h}
1019 The value of this macro is the most restrictive limit permitted by POSIX
1020 for the maximum number of streams that a single process can have open
1021 simultaneously.  Its value is @code{8}.
1023 @item _POSIX_TZNAME_MAX
1024 @standards{POSIX.1, limits.h}
1025 The value of this macro is the most restrictive limit permitted by POSIX
1026 for the maximum length of a time zone name.  Its value is @code{3}.
1028 @item _POSIX2_RE_DUP_MAX
1029 @standards{POSIX.2, limits.h}
1030 The value of this macro is the most restrictive limit permitted by POSIX
1031 for the numbers used in the @samp{\@{@var{min},@var{max}\@}} construct
1032 in a regular expression.  Its value is @code{255}.
1033 @end vtable
1035 @node Limits for Files
1036 @section Limits on File System Capacity
1038 The POSIX.1 standard specifies a number of parameters that describe the
1039 limitations of the file system.  It's possible for the system to have a
1040 fixed, uniform limit for a parameter, but this isn't the usual case.  On
1041 most systems, it's possible for different file systems (and, for some
1042 parameters, even different files) to have different maximum limits.  For
1043 example, this is very likely if you use NFS to mount some of the file
1044 systems from other machines.
1046 @pindex limits.h
1047 Each of the following macros is defined in @file{limits.h} only if the
1048 system has a fixed, uniform limit for the parameter in question.  If the
1049 system allows different file systems or files to have different limits,
1050 then the macro is undefined; use @code{pathconf} or @code{fpathconf} to
1051 find out the limit that applies to a particular file.  @xref{Pathconf}.
1053 Each parameter also has another macro, with a name starting with
1054 @samp{_POSIX}, which gives the lowest value that the limit is allowed to
1055 have on @emph{any} POSIX system.  @xref{File Minimums}.
1057 @cindex limits, link count of files
1058 @deftypevr Macro int LINK_MAX
1059 @standards{POSIX.1, limits.h (optional)}
1060 The uniform system limit (if any) for the number of names for a given
1061 file.  @xref{Hard Links}.
1062 @end deftypevr
1064 @cindex limits, terminal input queue
1065 @deftypevr Macro int MAX_CANON
1066 @standards{POSIX.1, limits.h}
1067 The uniform system limit (if any) for the amount of text in a line of
1068 input when input editing is enabled.  @xref{Canonical or Not}.
1069 @end deftypevr
1071 @deftypevr Macro int MAX_INPUT
1072 @standards{POSIX.1, limits.h}
1073 The uniform system limit (if any) for the total number of characters
1074 typed ahead as input.  @xref{I/O Queues}.
1075 @end deftypevr
1077 @cindex limits, file name length
1078 @deftypevr Macro int NAME_MAX
1079 @standards{POSIX.1, limits.h}
1080 The uniform system limit (if any) for the length of a file name component, not
1081 including the terminating null character.
1083 @strong{Portability Note:} On some systems, @theglibc{} defines
1084 @code{NAME_MAX}, but does not actually enforce this limit.
1085 @end deftypevr
1087 @deftypevr Macro int PATH_MAX
1088 @standards{POSIX.1, limits.h}
1089 The uniform system limit (if any) for the length of an entire file name (that
1090 is, the argument given to system calls such as @code{open}), including the
1091 terminating null character.
1093 @strong{Portability Note:} @Theglibc{} does not enforce this limit
1094 even if @code{PATH_MAX} is defined.
1095 @end deftypevr
1097 @cindex limits, pipe buffer size
1098 @deftypevr Macro int PIPE_BUF
1099 @standards{POSIX.1, limits.h}
1100 The uniform system limit (if any) for the number of bytes that can be
1101 written atomically to a pipe.  If multiple processes are writing to the
1102 same pipe simultaneously, output from different processes might be
1103 interleaved in chunks of this size.  @xref{Pipes and FIFOs}.
1104 @end deftypevr
1106 These are alternative macro names for some of the same information.
1108 @deftypevr Macro int MAXNAMLEN
1109 @standards{BSD, dirent.h}
1110 This is the BSD name for @code{NAME_MAX}.  It is defined in
1111 @file{dirent.h}.
1112 @end deftypevr
1114 @deftypevr Macro int FILENAME_MAX
1115 @standards{ISO, stdio.h}
1116 The value of this macro is an integer constant expression that
1117 represents the maximum length of a file name string.  It is defined in
1118 @file{stdio.h}.
1120 Unlike @code{PATH_MAX}, this macro is defined even if there is no actual
1121 limit imposed.  In such a case, its value is typically a very large
1122 number.  @strong{This is always the case on @gnuhurdsystems{}.}
1124 @strong{Usage Note:} Don't use @code{FILENAME_MAX} as the size of an
1125 array in which to store a file name!  You can't possibly make an array
1126 that big!  Use dynamic allocation (@pxref{Memory Allocation}) instead.
1127 @end deftypevr
1129 @node Options for Files
1130 @section Optional Features in File Support
1132 POSIX defines certain system-specific options in the system calls for
1133 operating on files.  Some systems support these options and others do
1134 not.  Since these options are provided in the kernel, not in the
1135 library, simply using @theglibc{} does not guarantee that any of these
1136 features is supported; it depends on the system you are using.  They can
1137 also vary between file systems on a single machine.
1139 @pindex unistd.h
1140 This section describes the macros you can test to determine whether a
1141 particular option is supported on your machine.  If a given macro is
1142 defined in @file{unistd.h}, then its value says whether the
1143 corresponding feature is supported.  (A value of @code{-1} indicates no;
1144 any other value indicates yes.)  If the macro is undefined, it means
1145 particular files may or may not support the feature.
1147 Since all the machines that support @theglibc{} also support NFS,
1148 one can never make a general statement about whether all file systems
1149 support the @code{_POSIX_CHOWN_RESTRICTED} and @code{_POSIX_NO_TRUNC}
1150 features.  So these names are never defined as macros in @theglibc{}.
1152 @deftypevr Macro int _POSIX_CHOWN_RESTRICTED
1153 @standards{POSIX.1, unistd.h}
1154 If this option is in effect, the @code{chown} function is restricted so
1155 that the only changes permitted to nonprivileged processes is to change
1156 the group owner of a file to either be the effective group ID of the
1157 process, or one of its supplementary group IDs.  @xref{File Owner}.
1158 @end deftypevr
1160 @deftypevr Macro int _POSIX_NO_TRUNC
1161 @standards{POSIX.1, unistd.h}
1162 If this option is in effect, file name components longer than
1163 @code{NAME_MAX} generate an @code{ENAMETOOLONG} error.  Otherwise, file
1164 name components that are too long are silently truncated.
1165 @end deftypevr
1167 @deftypevr Macro {unsigned char} _POSIX_VDISABLE
1168 @standards{POSIX.1, unistd.h}
1169 This option is only meaningful for files that are terminal devices.
1170 If it is enabled, then handling for special control characters can
1171 be disabled individually.  @xref{Special Characters}.
1172 @end deftypevr
1174 @pindex unistd.h
1175 If one of these macros is undefined, that means that the option might be
1176 in effect for some files and not for others.  To inquire about a
1177 particular file, call @code{pathconf} or @code{fpathconf}.
1178 @xref{Pathconf}.
1180 @node File Minimums
1181 @section Minimum Values for File System Limits
1183 Here are the names for the POSIX minimum upper bounds for some of the
1184 above parameters.  The significance of these values is that you can
1185 safely push to these limits without checking whether the particular
1186 system you are using can go that far.  In most cases @gnusystems{} do not
1187 have these strict limitations.  The actual limit should be requested if
1188 necessary.
1190 @vtable @code
1191 @item _POSIX_LINK_MAX
1192 @standards{POSIX.1, limits.h}
1193 The most restrictive limit permitted by POSIX for the maximum value of a
1194 file's link count.  The value of this constant is @code{8}; thus, you
1195 can always make up to eight names for a file without running into a
1196 system limit.
1198 @item _POSIX_MAX_CANON
1199 @standards{POSIX.1, limits.h}
1200 The most restrictive limit permitted by POSIX for the maximum number of
1201 bytes in a canonical input line from a terminal device.  The value of
1202 this constant is @code{255}.
1204 @item _POSIX_MAX_INPUT
1205 @standards{POSIX.1, limits.h}
1206 The most restrictive limit permitted by POSIX for the maximum number of
1207 bytes in a terminal device input queue (or typeahead buffer).
1208 @xref{Input Modes}.  The value of this constant is @code{255}.
1210 @item _POSIX_NAME_MAX
1211 @standards{POSIX.1, limits.h}
1212 The most restrictive limit permitted by POSIX for the maximum number of
1213 bytes in a file name component.  The value of this constant is
1214 @code{14}.
1216 @item _POSIX_PATH_MAX
1217 @standards{POSIX.1, limits.h}
1218 The most restrictive limit permitted by POSIX for the maximum number of
1219 bytes in a file name.  The value of this constant is @code{256}.
1221 @item _POSIX_PIPE_BUF
1222 @standards{POSIX.1, limits.h}
1223 The most restrictive limit permitted by POSIX for the maximum number of
1224 bytes that can be written atomically to a pipe.  The value of this
1225 constant is @code{512}.
1227 @item SYMLINK_MAX
1228 @standards{POSIX.1, limits.h}
1229 Maximum number of bytes in a symbolic link.
1231 @item POSIX_REC_INCR_XFER_SIZE
1232 @standards{POSIX.1, limits.h}
1233 Recommended increment for file transfer sizes between the
1234 @code{POSIX_REC_MIN_XFER_SIZE} and @code{POSIX_REC_MAX_XFER_SIZE}
1235 values.
1237 @item POSIX_REC_MAX_XFER_SIZE
1238 @standards{POSIX.1, limits.h}
1239 Maximum recommended file transfer size.
1241 @item POSIX_REC_MIN_XFER_SIZE
1242 @standards{POSIX.1, limits.h}
1243 Minimum recommended file transfer size.
1245 @item POSIX_REC_XFER_ALIGN
1246 @standards{POSIX.1, limits.h}
1247 Recommended file transfer buffer alignment.
1248 @end vtable
1250 @node Pathconf
1251 @section Using @code{pathconf}
1253 When your machine allows different files to have different values for a
1254 file system parameter, you can use the functions in this section to find
1255 out the value that applies to any particular file.
1257 These functions and the associated constants for the @var{parameter}
1258 argument are declared in the header file @file{unistd.h}.
1260 @deftypefun {long int} pathconf (const char *@var{filename}, int @var{parameter})
1261 @standards{POSIX.1, unistd.h}
1262 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1263 @c When __statfs_link_max finds an ext* filesystem, it may read
1264 @c /proc/mounts or similar as a mntent stream.
1265 @c __statfs_chown_restricted may read from
1266 @c /proc/sys/fs/xfs/restrict_chown as a file descriptor.
1267 This function is used to inquire about the limits that apply to
1268 the file named @var{filename}.
1270 The @var{parameter} argument should be one of the @samp{_PC_} constants
1271 listed below.
1273 The normal return value from @code{pathconf} is the value you requested.
1274 A value of @code{-1} is returned both if the implementation does not
1275 impose a limit, and in case of an error.  In the former case,
1276 @code{errno} is not set, while in the latter case, @code{errno} is set
1277 to indicate the cause of the problem.  So the only way to use this
1278 function robustly is to store @code{0} into @code{errno} just before
1279 calling it.
1281 Besides the usual file name errors (@pxref{File Name Errors}),
1282 the following error condition is defined for this function:
1284 @table @code
1285 @item EINVAL
1286 The value of @var{parameter} is invalid, or the implementation doesn't
1287 support the @var{parameter} for the specific file.
1288 @end table
1289 @end deftypefun
1291 @deftypefun {long int} fpathconf (int @var{filedes}, int @var{parameter})
1292 @standards{POSIX.1, unistd.h}
1293 @safety{@prelim{}@mtsafe{}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsfd{} @acsmem{}}}
1294 @c Same caveats as pathconf.
1295 This is just like @code{pathconf} except that an open file descriptor
1296 is used to specify the file for which information is requested, instead
1297 of a file name.
1299 The following @code{errno} error conditions are defined for this function:
1301 @table @code
1302 @item EBADF
1303 The @var{filedes} argument is not a valid file descriptor.
1305 @item EINVAL
1306 The value of @var{parameter} is invalid, or the implementation doesn't
1307 support the @var{parameter} for the specific file.
1308 @end table
1309 @end deftypefun
1311 Here are the symbolic constants that you can use as the @var{parameter}
1312 argument to @code{pathconf} and @code{fpathconf}.  The values are all
1313 integer constants.
1315 @vtable @code
1316 @item _PC_LINK_MAX
1317 @standards{POSIX.1, unistd.h}
1318 Inquire about the value of @code{LINK_MAX}.
1320 @item _PC_MAX_CANON
1321 @standards{POSIX.1, unistd.h}
1322 Inquire about the value of @code{MAX_CANON}.
1324 @item _PC_MAX_INPUT
1325 @standards{POSIX.1, unistd.h}
1326 Inquire about the value of @code{MAX_INPUT}.
1328 @item _PC_NAME_MAX
1329 @standards{POSIX.1, unistd.h}
1330 Inquire about the value of @code{NAME_MAX}.
1332 @item _PC_PATH_MAX
1333 @standards{POSIX.1, unistd.h}
1334 Inquire about the value of @code{PATH_MAX}.
1336 @item _PC_PIPE_BUF
1337 @standards{POSIX.1, unistd.h}
1338 Inquire about the value of @code{PIPE_BUF}.
1340 @item _PC_CHOWN_RESTRICTED
1341 @standards{POSIX.1, unistd.h}
1342 Inquire about the value of @code{_POSIX_CHOWN_RESTRICTED}.
1344 @item _PC_NO_TRUNC
1345 @standards{POSIX.1, unistd.h}
1346 Inquire about the value of @code{_POSIX_NO_TRUNC}.
1348 @item _PC_VDISABLE
1349 @standards{POSIX.1, unistd.h}
1350 Inquire about the value of @code{_POSIX_VDISABLE}.
1352 @item _PC_SYNC_IO
1353 @standards{POSIX.1, unistd.h}
1354 Inquire about the value of @code{_POSIX_SYNC_IO}.
1356 @item _PC_ASYNC_IO
1357 @standards{POSIX.1, unistd.h}
1358 Inquire about the value of @code{_POSIX_ASYNC_IO}.
1360 @item _PC_PRIO_IO
1361 @standards{POSIX.1, unistd.h}
1362 Inquire about the value of @code{_POSIX_PRIO_IO}.
1364 @item _PC_FILESIZEBITS
1365 @standards{LFS, unistd.h}
1366 Inquire about the availability of large files on the filesystem.
1368 @item _PC_REC_INCR_XFER_SIZE
1369 @standards{POSIX.1, unistd.h}
1370 Inquire about the value of @code{POSIX_REC_INCR_XFER_SIZE}.
1372 @item _PC_REC_MAX_XFER_SIZE
1373 @standards{POSIX.1, unistd.h}
1374 Inquire about the value of @code{POSIX_REC_MAX_XFER_SIZE}.
1376 @item _PC_REC_MIN_XFER_SIZE
1377 @standards{POSIX.1, unistd.h}
1378 Inquire about the value of @code{POSIX_REC_MIN_XFER_SIZE}.
1380 @item _PC_REC_XFER_ALIGN
1381 @standards{POSIX.1, unistd.h}
1382 Inquire about the value of @code{POSIX_REC_XFER_ALIGN}.
1383 @end vtable
1385 @strong{Portability Note:} On some systems, @theglibc{} does not
1386 enforce @code{_PC_NAME_MAX} or @code{_PC_PATH_MAX} limits.
1388 @node Utility Limits
1389 @section Utility Program Capacity Limits
1391 The POSIX.2 standard specifies certain system limits that you can access
1392 through @code{sysconf} that apply to utility behavior rather than the
1393 behavior of the library or the operating system.
1395 @Theglibc{} defines macros for these limits, and @code{sysconf}
1396 returns values for them if you ask; but these values convey no
1397 meaningful information.  They are simply the smallest values that
1398 POSIX.2 permits.
1400 @deftypevr Macro int BC_BASE_MAX
1401 @standards{POSIX.2, limits.h}
1402 The largest value of @code{obase} that the @code{bc} utility is
1403 guaranteed to support.
1404 @end deftypevr
1406 @deftypevr Macro int BC_DIM_MAX
1407 @standards{POSIX.2, limits.h}
1408 The largest number of elements in one array that the @code{bc} utility
1409 is guaranteed to support.
1410 @end deftypevr
1412 @deftypevr Macro int BC_SCALE_MAX
1413 @standards{POSIX.2, limits.h}
1414 The largest value of @code{scale} that the @code{bc} utility is
1415 guaranteed to support.
1416 @end deftypevr
1418 @deftypevr Macro int BC_STRING_MAX
1419 @standards{POSIX.2, limits.h}
1420 The largest number of characters in one string constant that the
1421 @code{bc} utility is guaranteed to support.
1422 @end deftypevr
1424 @deftypevr Macro int COLL_WEIGHTS_MAX
1425 @standards{POSIX.2, limits.h}
1426 The largest number of weights that can necessarily be used in defining
1427 the collating sequence for a locale.
1428 @end deftypevr
1430 @deftypevr Macro int EXPR_NEST_MAX
1431 @standards{POSIX.2, limits.h}
1432 The maximum number of expressions that can be nested within parentheses
1433 by the @code{expr} utility.
1434 @end deftypevr
1436 @deftypevr Macro int LINE_MAX
1437 @standards{POSIX.2, limits.h}
1438 The largest text line that the text-oriented POSIX.2 utilities can
1439 support.  (If you are using the GNU versions of these utilities, then
1440 there is no actual limit except that imposed by the available virtual
1441 memory, but there is no way that the library can tell you this.)
1442 @end deftypevr
1444 @deftypevr Macro int EQUIV_CLASS_MAX
1445 @standards{POSIX.2, limits.h}
1446 The maximum number of weights that can be assigned to an entry of the
1447 @code{LC_COLLATE} category @samp{order} keyword in a locale definition.
1448 @Theglibc{} does not presently support locale definitions.
1449 @end deftypevr
1451 @node Utility Minimums
1452 @section Minimum Values for Utility Limits
1454 @vtable @code
1455 @item _POSIX2_BC_BASE_MAX
1456 @standards{POSIX.2, limits.h}
1457 The most restrictive limit permitted by POSIX.2 for the maximum value of
1458 @code{obase} in the @code{bc} utility.  Its value is @code{99}.
1460 @item _POSIX2_BC_DIM_MAX
1461 @standards{POSIX.2, limits.h}
1462 The most restrictive limit permitted by POSIX.2 for the maximum size of
1463 an array in the @code{bc} utility.  Its value is @code{2048}.
1465 @item _POSIX2_BC_SCALE_MAX
1466 @standards{POSIX.2, limits.h}
1467 The most restrictive limit permitted by POSIX.2 for the maximum value of
1468 @code{scale} in the @code{bc} utility.  Its value is @code{99}.
1470 @item _POSIX2_BC_STRING_MAX
1471 @standards{POSIX.2, limits.h}
1472 The most restrictive limit permitted by POSIX.2 for the maximum size of
1473 a string constant in the @code{bc} utility.  Its value is @code{1000}.
1475 @item _POSIX2_COLL_WEIGHTS_MAX
1476 @standards{POSIX.2, limits.h}
1477 The most restrictive limit permitted by POSIX.2 for the maximum number
1478 of weights that can necessarily be used in defining the collating
1479 sequence for a locale.  Its value is @code{2}.
1481 @item _POSIX2_EXPR_NEST_MAX
1482 @standards{POSIX.2, limits.h}
1483 The most restrictive limit permitted by POSIX.2 for the maximum number
1484 of expressions nested within parenthesis when using the @code{expr} utility.
1485 Its value is @code{32}.
1487 @item _POSIX2_LINE_MAX
1488 @standards{POSIX.2, limits.h}
1489 The most restrictive limit permitted by POSIX.2 for the maximum size of
1490 a text line that the text utilities can handle.  Its value is
1491 @code{2048}.
1493 @item _POSIX2_EQUIV_CLASS_MAX
1494 @standards{POSIX.2, limits.h}
1495 The most restrictive limit permitted by POSIX.2 for the maximum number
1496 of weights that can be assigned to an entry of the @code{LC_COLLATE}
1497 category @samp{order} keyword in a locale definition.  Its value is
1498 @code{2}.  @Theglibc{} does not presently support locale
1499 definitions.
1500 @end vtable
1502 @node String Parameters
1503 @section String-Valued Parameters
1505 POSIX.2 defines a way to get string-valued parameters from the operating
1506 system with the function @code{confstr}:
1508 @deftypefun size_t confstr (int @var{parameter}, char *@var{buf}, size_t @var{len})
1509 @standards{POSIX.2, unistd.h}
1510 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
1511 This function reads the value of a string-valued system parameter,
1512 storing the string into @var{len} bytes of memory space starting at
1513 @var{buf}.  The @var{parameter} argument should be one of the
1514 @samp{_CS_} symbols listed below.
1516 The normal return value from @code{confstr} is the length of the string
1517 value that you asked for.  If you supply a null pointer for @var{buf},
1518 then @code{confstr} does not try to store the string; it just returns
1519 its length.  A value of @code{0} indicates an error.
1521 If the string you asked for is too long for the buffer (that is, longer
1522 than @code{@var{len} - 1}), then @code{confstr} stores just that much
1523 (leaving room for the terminating null character).  You can tell that
1524 this has happened because @code{confstr} returns a value greater than or
1525 equal to @var{len}.
1527 The following @code{errno} error conditions are defined for this function:
1529 @table @code
1530 @item EINVAL
1531 The value of the @var{parameter} is invalid.
1532 @end table
1533 @end deftypefun
1535 Currently there is just one parameter you can read with @code{confstr}:
1537 @vtable @code
1538 @item _CS_PATH
1539 @standards{POSIX.2, unistd.h}
1540 This parameter's value is the recommended default path for searching for
1541 executable files.  This is the path that a user has by default just
1542 after logging in.
1544 @item _CS_LFS_CFLAGS
1545 @standards{Unix98, unistd.h}
1546 The returned string specifies which additional flags must be given to
1547 the C compiler if a source is compiled using the
1548 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1550 @item _CS_LFS_LDFLAGS
1551 @standards{Unix98, unistd.h}
1552 The returned string specifies which additional flags must be given to
1553 the linker if a source is compiled using the
1554 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1556 @item _CS_LFS_LIBS
1557 @standards{Unix98, unistd.h}
1558 The returned string specifies which additional libraries must be linked
1559 to the application if a source is compiled using the
1560 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1562 @item _CS_LFS_LINTFLAGS
1563 @standards{Unix98, unistd.h}
1564 The returned string specifies which additional flags must be given to
1565 the lint tool if a source is compiled using the
1566 @code{_LARGEFILE_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1568 @item _CS_LFS64_CFLAGS
1569 @standards{Unix98, unistd.h}
1570 The returned string specifies which additional flags must be given to
1571 the C compiler if a source is compiled using the
1572 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1574 @item _CS_LFS64_LDFLAGS
1575 @standards{Unix98, unistd.h}
1576 The returned string specifies which additional flags must be given to
1577 the linker if a source is compiled using the
1578 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1580 @item _CS_LFS64_LIBS
1581 @standards{Unix98, unistd.h}
1582 The returned string specifies which additional libraries must be linked
1583 to the application if a source is compiled using the
1584 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1586 @item _CS_LFS64_LINTFLAGS
1587 @standards{Unix98, unistd.h}
1588 The returned string specifies which additional flags must be given to
1589 the lint tool if a source is compiled using the
1590 @code{_LARGEFILE64_SOURCE} feature select macro; @pxref{Feature Test Macros}.
1591 @end vtable
1593 The way to use @code{confstr} without any arbitrary limit on string size
1594 is to call it twice: first call it to get the length, allocate the
1595 buffer accordingly, and then call @code{confstr} again to fill the
1596 buffer, like this:
1598 @smallexample
1599 @group
1600 char *
1601 get_default_path (void)
1603   size_t len = confstr (_CS_PATH, NULL, 0);
1604   char *buffer = (char *) xmalloc (len);
1606   if (confstr (_CS_PATH, buf, len + 1) == 0)
1607     @{
1608       free (buffer);
1609       return NULL;
1610     @}
1612   return buffer;
1614 @end group
1615 @end smallexample