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