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