2 * ORIGINAL COPYRIGHT STATEMENT:
4 * Copyright (c) 1994 Winning Strategies, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Winning Strategies, Inc.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 * POSIX.2 getconf utility
36 * Originally Written by:
37 * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
39 * Heavily modified for inclusion in bash by
40 * Chet Ramey <chet@po.cwru.edu>
47 #ifdef HAVE_SYS_PARAM_H
48 # include <sys/param.h>
70 #include "bashgetopt.h"
81 enum { SYSCONF
, CONFSTR
, PATHCONF
, CONSTANT
, LLCONST
, G_UNDEF
} type
;
86 static size_t confstr
__P((int, char *, size_t));
90 static long sysconf
__P((int));
94 static long pathconf
__P((const char *, int));
97 /* Hack to `encode' values wider than long into a conf_variable */
98 #define VAL_LLONG_MIN -1000
99 #define VAL_LLONG_MAX -1001
100 #define VAL_ULLONG_MAX -1002
102 static const struct conf_variable conf_table
[] =
104 /* POSIX.2 Configurable Variable Values */
105 { "PATH", CONFSTR
, _CS_PATH
},
106 { "CS_PATH", CONFSTR
, _CS_PATH
},
108 /* POSIX.1 Configurable Variable Values (only Solaris?) */
109 #if defined (_CS_LFS_CFLAGS)
110 { "LFS_CFLAGS", CONFSTR
, _CS_LFS_CFLAGS
},
111 { "LFS_LDFLAGS", CONFSTR
, _CS_LFS_LDFLAGS
},
112 { "LFS_LIBS", CONFSTR
, _CS_LFS_LIBS
},
113 { "LFS_LINTFLAGS", CONFSTR
, _CS_LFS_LINTFLAGS
},
115 #if defined (_CS_LFS64_CFLAGS)
116 { "LFS64_CFLAGS", CONFSTR
, _CS_LFS64_CFLAGS
},
117 { "LFS64_LDFLAGS", CONFSTR
, _CS_LFS64_LDFLAGS
},
118 { "LFS64_LIBS", CONFSTR
, _CS_LFS64_LIBS
},
119 { "LFS64_LINTFLAGS", CONFSTR
, _CS_LFS64_LINTFLAGS
},
122 /* Single UNIX Specification version 2 Configurable Variable Values. The
123 SYSCONF variables say whether or not the appropriate CONFSTR variables
125 #if defined (_SC_XBS5_ILP32_OFF32)
126 { "XBS5_ILP32_OFF32", SYSCONF
, _SC_XBS5_ILP32_OFF32
},
127 { "_XBS5_ILP32_OFF32", SYSCONF
, _SC_XBS5_ILP32_OFF32
},
129 #if defined (_CS_XBS5_ILP32_OFF32_CFLAGS)
130 { "XBS5_ILP32_OFF32_CFLAGS", CONFSTR
, _CS_XBS5_ILP32_OFF32_CFLAGS
},
131 { "XBS5_ILP32_OFF32_LDFLAGS", CONFSTR
, _CS_XBS5_ILP32_OFF32_LDFLAGS
},
132 { "XBS5_ILP32_OFF32_LIBS", CONFSTR
, _CS_XBS5_ILP32_OFF32_LIBS
},
133 { "XBS5_ILP32_OFF32_LINTFLAGS", CONFSTR
, _CS_XBS5_ILP32_OFF32_LINTFLAGS
},
135 #if defined (_SC_XBS5_ILP32_OFFBIG)
136 { "XBS5_ILP32_OFFBIG", SYSCONF
, _SC_XBS5_ILP32_OFFBIG
},
137 { "_XBS5_ILP32_OFFBIG", SYSCONF
, _SC_XBS5_ILP32_OFFBIG
},
139 #if defined (_CS_XBS5_ILP32_OFFBIG_CFLAGS)
140 { "XBS5_ILP32_OFFBIG_CFLAGS", CONFSTR
, _CS_XBS5_ILP32_OFFBIG_CFLAGS
},
141 { "XBS5_ILP32_OFFBIG_LDFLAGS", CONFSTR
, _CS_XBS5_ILP32_OFFBIG_LDFLAGS
},
142 { "XBS5_ILP32_OFFBIG_LIBS", CONFSTR
, _CS_XBS5_ILP32_OFFBIG_LIBS
},
143 { "XBS5_ILP32_OFFBIG_LINTFLAGS", CONFSTR
, _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
},
145 #if defined (_SC_XBS5_LP64_OFF64)
146 { "XBS5_LP64_OFF64", SYSCONF
, _SC_XBS5_LP64_OFF64
},
147 { "_XBS5_LP64_OFF64", SYSCONF
, _SC_XBS5_LP64_OFF64
},
149 #if defined (_CS_XBS5_LP64_OFF64_CFLAGS)
150 { "XBS5_LP64_OFF64_CFLAGS", CONFSTR
, _CS_XBS5_LP64_OFF64_CFLAGS
},
151 { "XBS5_LP64_OFF64_LDFLAGS", CONFSTR
, _CS_XBS5_LP64_OFF64_LDFLAGS
},
152 { "XBS5_LP64_OFF64_LIBS", CONFSTR
, _CS_XBS5_LP64_OFF64_LIBS
},
153 { "XBS5_LP64_OFF64_LINTFLAGS", CONFSTR
, _CS_XBS5_LP64_OFF64_LINTFLAGS
},
155 #if defined (_SC_XBS5_LPBIG_OFFBIG)
156 { "XBS5_LPBIG_OFFBIG", SYSCONF
, _SC_XBS5_LPBIG_OFFBIG
},
157 { "_XBS5_LPBIG_OFFBIG", SYSCONF
, _SC_XBS5_LPBIG_OFFBIG
},
159 #if defined (_CS_XBS5_LPBIG_OFFBIG_CFLAGS)
160 { "XBS5_LPBIG_OFFBIG_CFLAGS", CONFSTR
, _CS_XBS5_LPBIG_OFFBIG_CFLAGS
},
161 { "XBS5_LPBIG_OFFBIG_LDFLAGS", CONFSTR
, _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
},
162 { "XBS5_LPBIG_OFFBIG_LIBS", CONFSTR
, _CS_XBS5_LPBIG_OFFBIG_LIBS
},
163 { "XBS5_LPBIG_OFFBIG_LINTFLAGS", CONFSTR
, _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
},
166 /* Single UNIX Specification version 3 (POSIX.1-200x) Configurable Variable
167 Values. The SYSCONF variables say whether or not the appropriate CONFSTR
168 variables are available. */
170 #if defined (_SC_POSIX_V6_ILP32_OFF32)
171 { "_POSIX_V6_ILP32_OFF32", SYSCONF
, _SC_POSIX_V6_ILP32_OFF32
},
173 #if defined (_CS_POSIX_V6_ILP32_OFF32_CFLAGS)
174 { "POSIX_V6_ILP32_OFF32_CFLAGS", CONFSTR
, _CS_POSIX_V6_ILP32_OFF32_CFLAGS
},
175 { "POSIX_V6_ILP32_OFF32_LDFLAGS", CONFSTR
, _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
},
176 { "POSIX_V6_ILP32_OFF32_LIBS", CONFSTR
, _CS_POSIX_V6_ILP32_OFF32_LIBS
},
178 #if defined (_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS)
179 { "POSIX_V6_ILP32_OFF32_LINTFLAGS", CONFSTR
, _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
},
181 #if defined (_SC_POSIX_V6_ILP32_OFFBIG)
182 { "_POSIX_V6_ILP32_OFFBIG", SYSCONF
, _SC_POSIX_V6_ILP32_OFFBIG
},
184 #if defined (_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS)
185 { "POSIX_V6_ILP32_OFFBIG_CFLAGS", CONFSTR
, _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
},
186 { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", CONFSTR
, _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
},
187 { "POSIX_V6_ILP32_OFFBIG_LIBS", CONFSTR
, _CS_POSIX_V6_ILP32_OFFBIG_LIBS
},
189 #if defined (_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS)
190 { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", CONFSTR
, _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
},
192 #if defined (_SC_POSIX_V6_LP64_OFF64)
193 { "_POSIX_V6_LP64_OFF64", SYSCONF
, _SC_POSIX_V6_LP64_OFF64
},
195 #if defined (_CS_POSIX_V6_LP64_OFF64_CFLAGS)
196 { "POSIX_V6_LP64_OFF64_CFLAGS", CONFSTR
, _CS_POSIX_V6_LP64_OFF64_CFLAGS
},
197 { "POSIX_V6_LP64_OFF64_LDFLAGS", CONFSTR
, _CS_POSIX_V6_LP64_OFF64_LDFLAGS
},
198 { "POSIX_V6_LP64_OFF64_LIBS", CONFSTR
, _CS_POSIX_V6_LP64_OFF64_LIBS
},
200 #if defined (CS_POSIX_V6_LP64_OFF64_LINTFLAGS)
201 { "POSIX_V6_LP64_OFF64_LINTFLAGS", CONFSTR
, _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
},
203 #if defined (_SC_POSIX_V6_LPBIG_OFFBIG)
204 { "_POSIX_V6_LPBIG_OFFBIG", SYSCONF
, _SC_POSIX_V6_LPBIG_OFFBIG
},
206 #if defined (_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS)
207 { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", CONFSTR
, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
},
208 { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", CONFSTR
, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
},
209 { "POSIX_V6_LPBIG_OFFBIG_LIBS", CONFSTR
, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
},
211 #if defined (_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS)
212 { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", CONFSTR
, _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
},
215 #if defined (_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS)
216 { "POSIX_6_WIDTH_RESTRICTED_ENVS", CONFSTR
, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
},
219 /* POSIX.2 Utility Limit Minimum Values */
220 #ifdef _POSIX2_BC_BASE_MAX
221 { "POSIX2_BC_BASE_MAX", CONSTANT
, _POSIX2_BC_BASE_MAX
},
223 { "POSIX2_BC_BASE_MAX", G_UNDEF
, -1 },
225 #ifdef _POSIX2_BC_DIM_MAX
226 { "POSIX2_BC_DIM_MAX", CONSTANT
, _POSIX2_BC_DIM_MAX
},
228 { "POSIX2_BC_DIM_MAX", G_UNDEF
, -1 },
230 #ifdef _POSIX2_BC_SCALE_MAX
231 { "POSIX2_BC_SCALE_MAX", CONSTANT
, _POSIX2_BC_SCALE_MAX
},
233 { "POSIX2_BC_SCALE_MAX", G_UNDEF
, -1 },
235 #ifdef _POSIX2_BC_STRING_MAX
236 { "POSIX2_BC_STRING_MAX", CONSTANT
, _POSIX2_BC_STRING_MAX
},
238 { "POSIX2_BC_STRING_MAX", G_UNDEF
, -1 },
240 #ifdef _POSIX2_CHARCLASS_NAME_MAX
241 { "POSIX2_CHARCLASS_NAME_MAX", CONSTANT
, _POSIX2_CHARCLASS_NAME_MAX
},
243 { "POSIX2_CHARCLASS_NAME_MAX", G_UNDEF
, -1 },
245 #ifdef _POSIX2_COLL_WEIGHTS_MAX
246 { "POSIX2_COLL_WEIGHTS_MAX", CONSTANT
, _POSIX2_COLL_WEIGHTS_MAX
},
248 { "POSIX2_COLL_WEIGHTS_MAX", G_UNDEF
, -1 },
250 #if defined (_POSIX2_EQUIV_CLASS_MAX)
251 { "POSIX2_EQUIV_CLASS_MAX", CONSTANT
, _POSIX2_EQUIV_CLASS_MAX
},
253 #ifdef _POSIX2_EXPR_NEST_MAX
254 { "POSIX2_EXPR_NEST_MAX", CONSTANT
, _POSIX2_EXPR_NEST_MAX
},
256 { "POSIX2_EXPR_NEST_MAX", G_UNDEF
, -1 },
258 #ifdef _POSIX2_LINE_MAX
259 { "POSIX2_LINE_MAX", CONSTANT
, _POSIX2_LINE_MAX
},
261 { "POSIX2_LINE_MAX", G_UNDEF
, -1 },
263 #ifdef _POSIX2_RE_DUP_MAX
264 { "POSIX2_RE_DUP_MAX", CONSTANT
, _POSIX2_RE_DUP_MAX
},
266 { "POSIX2_RE_DUP_MAX", G_UNDEF
, -1 },
268 #if defined (_POSIX2_VERSION)
269 { "POSIX2_VERSION", CONSTANT
, _POSIX2_VERSION
},
271 # if !defined (_SC_2_VERSION)
272 { "POSIX2_VERSION", G_UNDEF
, -1 },
276 #ifdef _POSIX2_BC_BASE_MAX
277 { "_POSIX2_BC_BASE_MAX", CONSTANT
, _POSIX2_BC_BASE_MAX
},
279 { "_POSIX2_BC_BASE_MAX", G_UNDEF
, -1 },
281 #ifdef _POSIX2_BC_DIM_MAX
282 { "_POSIX2_BC_DIM_MAX", CONSTANT
, _POSIX2_BC_DIM_MAX
},
284 { "_POSIX2_BC_DIM_MAX", G_UNDEF
, -1 },
286 #ifdef _POSIX2_BC_SCALE_MAX
287 { "_POSIX2_BC_SCALE_MAX", CONSTANT
, _POSIX2_BC_SCALE_MAX
},
289 { "_POSIX2_BC_SCALE_MAX", G_UNDEF
, -1 },
291 #ifdef _POSIX2_BC_STRING_MAX
292 { "_POSIX2_BC_STRING_MAX", CONSTANT
, _POSIX2_BC_STRING_MAX
},
294 { "_POSIX2_BC_STRING_MAX", G_UNDEF
, -1 },
296 #ifdef _POSIX2_CHARCLASS_NAME_MAX
297 { "_POSIX2_CHARCLASS_NAME_MAX", CONSTANT
, _POSIX2_CHARCLASS_NAME_MAX
},
299 { "_POSIX2_CHARCLASS_NAME_MAX", G_UNDEF
, -1 },
301 #ifdef _POSIX2_COLL_WEIGHTS_MAX
302 { "_POSIX2_COLL_WEIGHTS_MAX", CONSTANT
, _POSIX2_COLL_WEIGHTS_MAX
},
304 { "_POSIX2_COLL_WEIGHTS_MAX", G_UNDEF
, -1 },
306 #if defined (_POSIX2_EQUIV_CLASS_MAX)
307 { "POSIX2_EQUIV_CLASS_MAX", CONSTANT
, _POSIX2_EQUIV_CLASS_MAX
},
309 #ifdef _POSIX2_EXPR_NEST_MAX
310 { "_POSIX2_EXPR_NEST_MAX", CONSTANT
, _POSIX2_EXPR_NEST_MAX
},
312 { "_POSIX2_EXPR_NEST_MAX", G_UNDEF
, -1 },
314 #ifdef _POSIX2_LINE_MAX
315 { "_POSIX2_LINE_MAX", CONSTANT
, _POSIX2_LINE_MAX
},
317 { "_POSIX2_LINE_MAX", G_UNDEF
, -1 },
319 #ifdef _POSIX2_RE_DUP_MAX
320 { "_POSIX2_RE_DUP_MAX", CONSTANT
, _POSIX2_RE_DUP_MAX
},
322 { "_POSIX2_RE_DUP_MAX", G_UNDEF
, -1 },
325 /* X/OPEN Maxmimum Values */
326 #ifdef _XOPEN_IOV_MAX
327 { "_XOPEN_IOV_MAX", CONSTANT
, _XOPEN_IOV_MAX
},
329 { "_XOPEN_IOV_MAX", G_UNDEF
, -1 },
331 #ifdef _XOPEN_NAME_MAX
332 { "_XOPEN_NAME_MAX", CONSTANT
, _XOPEN_NAME_MAX
},
334 { "_XOPEN_NAME_MAX", G_UNDEF
, -1 },
336 #ifdef _XOPEN_PATH_MAX
337 { "_XOPEN_PATH_MAX", CONSTANT
, _XOPEN_PATH_MAX
},
339 { "_XOPEN_PATH_MAX", G_UNDEF
, -1 },
342 /* POSIX.1 Minimum Values */
343 #ifdef _POSIX_AIO_LISTIO_MAX
344 { "_POSIX_AIO_LISTIO_MAX", CONSTANT
, _POSIX_AIO_LISTIO_MAX
},
346 { "_POSIX_AIO_LISTIO_MAX", G_UNDEF
, -1 },
348 #ifdef _POSIX_AIO_MAX
349 { "_POSIX_AIO_MAX", CONSTANT
, _POSIX_AIO_MAX
},
351 { "_POSIX_AIO_MAX", G_UNDEF
, -1 },
353 #ifdef _POSIX_ARG_MAX
354 { "_POSIX_ARG_MAX", CONSTANT
, _POSIX_ARG_MAX
},
356 { "_POSIX_ARG_MAX", G_UNDEF
, -1 },
358 #ifdef _POSIX_CHILD_MAX
359 { "_POSIX_CHILD_MAX", CONSTANT
, _POSIX_CHILD_MAX
},
361 { "_POSIX_CHILD_MAX", G_UNDEF
, -1 },
363 #ifdef _POSIX_DELAYTIMER_MAX
364 { "_POSIX_DELAYTIMER_MAX", CONSTANT
, _POSIX_DELAYTIMER_MAX
},
366 { "_POSIX_DELAYTIMER_MAX", G_UNDEF
, -1 },
368 #ifdef _POSIX_HOST_NAME_MAX
369 { "_POSIX_HOST_NAME_MAX", CONSTANT
, _POSIX_HOST_NAME_MAX
},
371 { "_POSIX_HOST_NAME_MAX", G_UNDEF
, -1 },
373 #ifdef _POSIX_LINK_MAX
374 { "_POSIX_LINK_MAX", CONSTANT
, _POSIX_LINK_MAX
},
376 { "_POSIX_LINK_MAX", G_UNDEF
, -1 },
378 #ifdef _POSIX_LOGIN_NAME_MAX
379 { "_POSIX_LOGIN_NAME_MAX", CONSTANT
, _POSIX_LOGIN_NAME_MAX
},
381 { "_POSIX_LOGIN_NAME_MAX", G_UNDEF
, -1 },
383 #ifdef _POSIX_MAX_CANON
384 { "_POSIX_MAX_CANON", CONSTANT
, _POSIX_MAX_CANON
},
386 { "_POSIX_MAX_CANON", G_UNDEF
, -1 },
388 #ifdef _POSIX_MAX_INPUT
389 { "_POSIX_MAX_INPUT", CONSTANT
, _POSIX_MAX_INPUT
},
391 { "_POSIX_MAX_INPUT", G_UNDEF
, -1 },
393 #ifdef _POSIX_MQ_OPEN_MAX
394 { "_POSIX_MQ_OPEN_MAX", CONSTANT
, _POSIX_MQ_OPEN_MAX
},
396 { "_POSIX_MQ_OPEN_MAX", G_UNDEF
, -1 },
398 #ifdef _POSIX_MQ_PRIO_MAX
399 { "_POSIX_MQ_PRIO_MAX", CONSTANT
, _POSIX_MQ_PRIO_MAX
},
401 { "_POSIX_MQ_PRIO_MAX", G_UNDEF
, -1 },
403 #ifdef _POSIX_NAME_MAX
404 { "_POSIX_NAME_MAX", CONSTANT
, _POSIX_NAME_MAX
},
406 { "_POSIX_NAME_MAX", G_UNDEF
, -1 },
408 #ifdef _POSIX_NGROUPS_MAX
409 { "_POSIX_NGROUPS_MAX", CONSTANT
, _POSIX_NGROUPS_MAX
},
411 { "_POSIX_NGROUPS_MAX", G_UNDEF
, -1 },
413 #ifdef _POSIX_OPEN_MAX
414 { "_POSIX_OPEN_MAX", CONSTANT
, _POSIX_OPEN_MAX
},
416 { "_POSIX_OPEN_MAX", G_UNDEF
, -1 },
418 #ifdef _POSIX_PATH_MAX
419 { "_POSIX_PATH_MAX", CONSTANT
, _POSIX_PATH_MAX
},
421 { "_POSIX_PATH_MAX", G_UNDEF
, -1 },
423 #ifdef _POSIX_PIPE_BUF
424 { "_POSIX_PIPE_BUF", CONSTANT
, _POSIX_PIPE_BUF
},
426 { "_POSIX_PIPE_BUF", G_UNDEF
, -1 },
428 #ifdef _POSIX_RE_DUP_MAX
429 { "_POSIX_RE_DUP_MAX", CONSTANT
, _POSIX_RE_DUP_MAX
},
431 { "_POSIX_RE_DUP_MAX", G_UNDEF
, -1 },
433 #ifdef _POSIX_RTSIG_MAX
434 { "_POSIX_RTSIG_MAX", CONSTANT
, _POSIX_RTSIG_MAX
},
436 { "_POSIX_RTSIG_MAX", G_UNDEF
, -1 },
438 #ifdef _POSIX_SEM_NSEMS_MAX
439 { "_POSIX_SEM_NSEMS_MAX", CONSTANT
, _POSIX_SEM_NSEMS_MAX
},
441 { "_POSIX_SEM_NSEMS_MAX", G_UNDEF
, -1 },
443 #ifdef _POSIX_SEM_VALUE_MAX
444 { "_POSIX_SEM_VALUE_MAX", CONSTANT
, _POSIX_SEM_VALUE_MAX
},
446 { "_POSIX_SEM_VALUE_MAX", G_UNDEF
, -1 },
448 #ifdef _POSIX_SIGQUEUE_MAX
449 { "_POSIX_SIGQUEUE_MAX", CONSTANT
, _POSIX_SIGQUEUE_MAX
},
451 { "_POSIX_SIGQUEUE_MAX", G_UNDEF
, -1 },
453 #ifdef _POSIX_SSIZE_MAX
454 { "_POSIX_SSIZE_MAX", CONSTANT
, _POSIX_SSIZE_MAX
},
456 { "_POSIX_SSIZE_MAX", G_UNDEF
, -1 },
458 #ifdef _POSIX_SS_REPL_MAX
459 { "_POSIX_SS_REPL_MAX", CONSTANT
, _POSIX_SS_REPL_MAX
},
461 { "_POSIX_SS_REPL_MAX", G_UNDEF
, -1 },
463 #ifdef _POSIX_STREAM_MAX
464 { "_POSIX_STREAM_MAX", CONSTANT
, _POSIX_STREAM_MAX
},
466 { "_POSIX_STREAM_MAX", G_UNDEF
, -1 },
468 #ifdef _POSIX_SYMLINK_MAX
469 { "_POSIX_SYMLINK_MAX", CONSTANT
, _POSIX_SYMLINK_MAX
},
471 { "_POSIX_SYMLINK_MAX", G_UNDEF
, -1 },
473 #ifdef _POSIX_SYMLOOP_MAX
474 { "_POSIX_SYMLOOP_MAX", CONSTANT
, _POSIX_SYMLOOP_MAX
},
476 { "_POSIX_SYMLOOP_MAX", G_UNDEF
, -1 },
478 #ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
479 { "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", CONSTANT
, _POSIX_THREAD_DESTRUCTOR_ITERATIONS
},
481 { "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", G_UNDEF
, -1 },
483 #ifdef _POSIX_THREAD_KEYS_MAX
484 { "_POSIX_THREAD_KEYS_MAX", CONSTANT
, _POSIX_THREAD_KEYS_MAX
},
486 { "_POSIX_THREAD_KEYS_MAX", G_UNDEF
, -1 },
488 #ifdef _POSIX_THREAD_THREADS_MAX
489 { "_POSIX_THREAD_THREADS_MAX",CONSTANT
, _POSIX_THREAD_THREADS_MAX
},
491 { "_POSIX_THREAD_THREADS_MAX",G_UNDEF
, -1 },
493 #ifdef _POSIX_TIMER_MAX
494 { "_POSIX_TIMER_MAX", CONSTANT
, _POSIX_TIMER_MAX
},
496 { "_POSIX_TIMER_MAX", G_UNDEF
, -1 },
498 #ifdef _POSIX_TRACE_EVENT_NAME_MAX
499 { "_POSIX_TRACE_EVENT_NAME_MAX", CONSTANT
, _POSIX_TRACE_EVENT_NAME_MAX
},
501 { "_POSIX_TRACE_EVENT_NAME_MAX", G_UNDEF
, -1 },
503 #ifdef _POSIX_TRACE_NAME_MAX
504 { "_POSIX_TRACE_NAME_MAX", CONSTANT
, _POSIX_TRACE_NAME_MAX
},
506 { "_POSIX_TRACE_NAME_MAX", G_UNDEF
, -1 },
508 #ifdef _POSIX_TRACE_SYS_MAX
509 { "_POSIX_TRACE_SYS_MAX", CONSTANT
, _POSIX_TRACE_SYS_MAX
},
511 { "_POSIX_TRACE_SYS_MAX", G_UNDEF
, -1 },
513 #ifdef _POSIX_TRACE_USER_EVENT_MAX
514 { "_POSIX_TRACE_USER_EVENT_MAX", CONSTANT
, _POSIX_TRACE_USER_EVENT_MAX
},
516 { "_POSIX_TRACE_USER_EVENT_MAX", G_UNDEF
, -1 },
518 #ifdef _POSIX_TTY_NAME_MAX
519 { "_POSIX_TTY_NAME_MAX", CONSTANT
, _POSIX_TTY_NAME_MAX
},
521 { "_POSIX_TTY_NAME_MAX", G_UNDEF
, -1 },
523 #ifdef _POSIX_TZNAME_MAX
524 { "_POSIX_TZNAME_MAX", CONSTANT
, _POSIX_TZNAME_MAX
},
526 { "_POSIX_TZNAME_MAX", G_UNDEF
, -1 },
529 /* POSIX.1 Maximum Values */
530 #ifdef _POSIX_CLOCKRES_MIN
531 { "_POSIX_CLOCKRES_MIN", CONSTANT
, _POSIX_CLOCKRES_MIN
},
533 { "_POSIX_CLOCKRES_MIN", G_UNDEF
, -1 },
536 /* POSIX.1-2001/XPG6 (and later) Runtime Invariants from <limits.h> */
537 #ifdef _SC_SS_REPL_MAX
538 { "SS_REPL_MAX", SYSCONF
, _SC_SS_REPL_MAX
},
540 #ifdef _SC_TRACE_EVENT_NAME_MAX
541 { "TRACE_EVENT_NAME_MAX", SYSCONF
, _SC_TRACE_EVENT_NAME_MAX
},
543 #ifdef _SC_TRACE_NAME_MAX
544 { "TRACE_NAME_MAX", SYSCONF
, _SC_TRACE_NAME_MAX
},
546 #ifdef _SC_TRACE_SYS_MAX
547 { "TRACE_SYS_MAX", SYSCONF
, _SC_TRACE_SYS_MAX
},
549 #ifdef _SC_TRACE_USER_EVENT_MAX
550 { "TRACE_USER_EVENT_MAX", SYSCONF
, _SC_TRACE_USER_EVENT_MAX
},
553 /* POSIX.2/XPG 4.2 (and later) Symbolic Utility Limits */
554 #ifdef _SC_BC_BASE_MAX
555 { "BC_BASE_MAX", SYSCONF
, _SC_BC_BASE_MAX
},
557 #ifdef _SC_BC_DIM_MAX
558 { "BC_DIM_MAX", SYSCONF
, _SC_BC_DIM_MAX
},
560 #ifdef _SC_BC_SCALE_MAX
561 { "BC_SCALE_MAX", SYSCONF
, _SC_BC_SCALE_MAX
},
563 #ifdef _SC_BC_STRING_MAX
564 { "BC_STRING_MAX", SYSCONF
, _SC_BC_STRING_MAX
},
566 #ifdef CHARCLASS_NAME_MAX
567 { "CHARCLASS_NAME_MAX", CONSTANT
, CHARCLASS_NAME_MAX
},
569 #ifdef _SC_COLL_WEIGHTS_MAX
570 { "COLL_WEIGHTS_MAX", SYSCONF
, _SC_COLL_WEIGHTS_MAX
},
572 #ifdef _SC_EXPR_NEST_MAX
573 { "EXPR_NEST_MAX", SYSCONF
, _SC_EXPR_NEST_MAX
},
576 { "LINE_MAX", SYSCONF
, _SC_LINE_MAX
},
579 { "NL_ARGMAX", CONSTANT
, NL_ARGMAX
},
582 { "NL_LANGMAX", CONSTANT
, NL_LANGMAX
},
585 { "NL_MSGMAX", CONSTANT
, NL_MSGMAX
},
588 { "NL_NMAX", CONSTANT
, NL_NMAX
},
591 { "NL_SETMAX", CONSTANT
, NL_SETMAX
},
594 { "NL_TEXTMAX", CONSTANT
, NL_TEXTMAX
},
596 #ifdef _SC_RAW_SOCKET
597 { "RAW_SOCKET", SYSCONF
, _SC_RAW_SOCKET
},
599 #ifdef _SC_RE_DUP_MAX
600 { "RE_DUP_MAX", SYSCONF
, _SC_RE_DUP_MAX
},
603 /* POSIX.2 Optional Facility Configuration Values */
605 { "POSIX2_C_BIND", SYSCONF
, _SC_2_C_BIND
},
607 { "POSIX2_C_BIND", G_UNDEF
, -1 },
610 { "POSIX2_C_DEV", SYSCONF
, _SC_2_C_DEV
},
612 { "POSIX2_C_DEV", G_UNDEF
, -1 },
614 #if defined (_SC_2_C_VERSION)
615 { "POSIX2_C_VERSION", SYSCONF
, _SC_2_C_VERSION
},
617 { "POSIX2_C_VERSION", G_UNDEF
, -1 },
619 #if defined (_SC_2_CHAR_TERM)
620 { "POSIX2_CHAR_TERM", SYSCONF
, _SC_2_CHAR_TERM
},
622 { "POSIX2_CHAR_TERM", G_UNDEF
, -1 },
624 #ifdef _SC_2_FORT_DEV
625 { "POSIX2_FORT_DEV", SYSCONF
, _SC_2_FORT_DEV
},
627 { "POSIX2_FORT_DEV", G_UNDEF
, -1 },
629 #ifdef _SC_2_FORT_RUN
630 { "POSIX2_FORT_RUN", SYSCONF
, _SC_2_FORT_RUN
},
632 { "POSIX2_FORT_RUN", G_UNDEF
, -1 },
634 #ifdef _SC_2_LOCALEDEF
635 { "POSIX2_LOCALEDEF", SYSCONF
, _SC_2_LOCALEDEF
},
637 { "POSIX2_LOCALEDEF", G_UNDEF
, -1 },
640 { "POSIX2_SW_DEV", SYSCONF
, _SC_2_SW_DEV
},
642 { "POSIX2_SW_DEV", G_UNDEF
, -1 },
644 #if defined (_SC2_UPE)
645 { "POSIX2_UPE", SYSCONF
, _SC_2_UPE
},
647 { "POSIX2_UPE", G_UNDEF
, -1 },
649 #if !defined (_POSIX2_VERSION) && defined (_SC_2_VERSION)
650 { "_POSIX2_VERSION", SYSCONF
, _SC_2_VERSION
},
652 { "_POSIX2_VERSION", G_UNDEF
, -1 },
654 #if defined (_SC_REGEX_VERSION)
655 { "REGEX_VERSION", SYSCONF
, _SC_REGEX_VERSION
},
656 { "_REGEX_VERSION", SYSCONF
, _SC_REGEX_VERSION
},
658 { "REGEX_VERSION", G_UNDEF
, -1 },
659 { "_REGEX_VERSION", G_UNDEF
, -1 },
662 #if defined (_SC_2_PBS)
663 { "_POSIX2_PBS", SYSCONF
, _SC_2_PBS
},
664 { "_POSIX2_PBS_ACCOUNTING", SYSCONF
, _SC_2_PBS_ACCOUNTING
},
665 # if defined (_SC_2_PBS_CHECKPOINT)
666 { "_POSIX2_PBS_CHECKPOINT", SYSCONF
, _SC_2_PBS_CHECKPOINT
},
668 { "_POSIX2_PBS_LOCATE", SYSCONF
, _SC_2_PBS_LOCATE
},
669 { "_POSIX2_PBS_MESSAGE", SYSCONF
, _SC_2_PBS_MESSAGE
},
670 { "_POSIX2_PBS_TRACK", SYSCONF
, _SC_2_PBS_TRACK
},
673 /* POSIX.1 Configurable System Variables */
675 { "ARG_MAX", SYSCONF
, _SC_ARG_MAX
},
678 { "CHILD_MAX", SYSCONF
, _SC_CHILD_MAX
},
681 { "CLK_TCK", SYSCONF
, _SC_CLK_TCK
},
683 #ifdef _SC_DELAYTIMER_MAX
684 { "DELAYTIMER_MAX", SYSCONF
, _SC_DELAYTIMER_MAX
},
686 #ifdef _SC_NGROUPS_MAX
687 { "NGROUPS_MAX", SYSCONF
, _SC_NGROUPS_MAX
},
690 { "NZERO", CONSTANT
, NZERO
},
693 { "OPEN_MAX", SYSCONF
, _SC_OPEN_MAX
},
696 { "PASS_MAX", CONSTANT
, PASS_MAX
},
698 #ifdef _SC_STREAM_MAX
699 { "STREAM_MAX", SYSCONF
, _SC_STREAM_MAX
},
702 { "TMP_MAX", CONSTANT
, TMP_MAX
},
704 #ifdef _SC_TZNAME_MAX
705 { "TZNAME_MAX", SYSCONF
, _SC_TZNAME_MAX
},
708 /* POSIX.1 Optional Facility Configuration Values */
709 #if defined (_SC_ADVISORY_INFO)
710 { "_POSIX_ADVISORY_INFO", SYSCONF
, _SC_ADVISORY_INFO
},
712 #if defined (_SC_ASYNCHRONOUS_IO)
713 { "_POSIX_ASYNCHRONOUS_IO", SYSCONF
, _SC_ASYNCHRONOUS_IO
},
715 #if defined (_SC_BARRIERS)
716 { "_POSIX_BARRIERS", SYSCONF
, _SC_BARRIERS
},
718 #if defined (_SC_BASE)
719 { "_POSIX_BASE", SYSCONF
, _SC_BASE
},
721 #if defined (_SC_C_LANG_SUPPORT)
722 { "_POSIX_C_LANG_SUPPORT", SYSCONF
, _SC_C_LANG_SUPPORT
},
724 #if defined (_SC_C_LANG_SUPPORT_R)
725 { "_POSIX_C_LANG_SUPPORT_R", SYSCONF
, _SC_C_LANG_SUPPORT_R
},
727 #if defined (_SC_CLOCK_SELECTION)
728 { "_POSIX_CLOCK_SELECTION", SYSCONF
, _SC_CLOCK_SELECTION
},
730 #if defined (_SC_CPUTIME)
731 { "_POSIX_CPUTIME", SYSCONF
, _SC_CPUTIME
},
733 #if defined (_SC_DEVICE_IO)
734 { "_POSIX_DEVICE_IO", SYSCONF
, _SC_DEVICE_IO
},
736 #if defined (_SC_DEVICE_SPECIFIC)
737 { "_POSIX_DEVICE_SPECIFIC", SYSCONF
, _SC_DEVICE_SPECIFIC
},
739 #if defined (_SC_DEVICE_SPECIFIC_R)
740 { "_POSIX_DEVICE_SPECIFIC_R", SYSCONF
, _SC_DEVICE_SPECIFIC_R
},
742 #if defined (_SC_FD_MGMT)
743 { "_POSIX_FD_MGMT", SYSCONF
, _SC_FD_MGMT
},
745 #if defined (_SC_FIFO)
746 { "_POSIX_FIFO", SYSCONF
, _SC_FIFO
},
748 #if defined (_SC_FILE_ATTRIBUTES)
749 { "_POSIX_FILE_ATTRIBUTES", SYSCONF
, _SC_FILE_ATTRIBUTES
},
751 #if defined (_SC_FILE_LOCKING)
752 { "_POSIX_FILE_LOCKING", SYSCONF
, _SC_FILE_LOCKING
},
754 #if defined (_SC_FILE_SYSTEM)
755 { "_POSIX_FILE_SYSTEM", SYSCONF
, _SC_FILE_SYSTEM
},
757 #if defined (_SC_FSYNC)
758 { "_POSIX_FSYNC", SYSCONF
, _SC_FSYNC
},
760 #if defined (_SC_IPV6)
761 { "_POSIX_IPV6", SYSCONF
, _SC_IPV6
},
763 #if defined (_SC_JOB_CONTROL)
764 { "_POSIX_JOB_CONTROL", SYSCONF
, _SC_JOB_CONTROL
},
766 #if defined (_SC_MAPPED_FILES)
767 { "_POSIX_MAPPED_FILES", SYSCONF
, _SC_MAPPED_FILES
},
769 #if defined (_SC_MEMLOCK)
770 { "_POSIX_MEMLOCK", SYSCONF
, _SC_MEMLOCK
},
772 #if defined (_SC_MEMLOCK_RANGE)
773 { "_POSIX_MEMLOCK_RANGE", SYSCONF
, _SC_MEMLOCK_RANGE
},
775 #if defined (_SC_MEMORY_PROTECTION)
776 { "_POSIX_MEMORY_PROTECTION", SYSCONF
, _SC_MEMORY_PROTECTION
},
778 #if defined (_SC_MESSAGE_PASSING)
779 { "_POSIX_MESSAGE_PASSING", SYSCONF
, _SC_MESSAGE_PASSING
},
781 #if defined (_SC_MONOTONIC_CLOCK)
782 { "_POSIX_MONOTONIC_CLOCK", SYSCONF
, _SC_MONOTONIC_CLOCK
},
784 #if defined (_SC_MULTI_PROCESS)
785 { "_POSIX_MULTI_PROCESS", SYSCONF
, _SC_MULTI_PROCESS
},
787 #if defined (_SC_NETWORKING)
788 { "_POSIX_NETWORKING", SYSCONF
, _SC_NETWORKING
},
790 #if defined (_SC_PIPE)
791 { "_POSIX_PIPE", SYSCONF
, _SC_PIPE
},
793 #if defined (SC_PRIORITIZED_IO)
794 { "_POSIX_PRIORITIZED_IO", SYSCONF
, _SC_PRIORITIZED_IO
},
796 #if defined (_SC_PRIORITY_SCHEDULING)
797 { "_POSIX_PRIORITY_SCHEDULING", SYSCONF
, _SC_PRIORITY_SCHEDULING
},
799 #if defined (_SC_READER_WRITER_LOCKS)
800 { "_POSIX_READER_WRITER_LOCKS", SYSCONF
, _SC_READER_WRITER_LOCKS
},
802 #if defined (_SC_RAW_SOCKETS)
803 { "_POSIX_RAW_SOCKETS", SYSCONF
, _SC_RAW_SOCKETS
},
805 #if defined (_SC_REALTIME_SIGNALS)
806 { "_POSIX_REALTIME_SIGNALS", SYSCONF
, _SC_REALTIME_SIGNALS
},
808 #if defined (_SC_REGEXP)
809 { "_POSIX_REGEXP", SYSCONF
, _SC_REGEXP
},
811 #if defined (_SC_SAVED_IDS)
812 { "_POSIX_SAVED_IDS", SYSCONF
, _SC_SAVED_IDS
},
814 #if defined (_SC_SEMAPHORES)
815 { "_POSIX_SEMAPHORES", SYSCONF
, _SC_SEMAPHORES
},
817 #if defined (_SC_SHARED_MEMORY_OBJECTS)
818 { "_POSIX_SHARED_MEMORY_OBJECTS", SYSCONF
, _SC_SHARED_MEMORY_OBJECTS
},
820 { "_POSIX_SHELL", CONSTANT
, 1 },
821 #if defined (_SC_SIGNALS)
822 { "_POSIX_SIGNALS", SYSCONF
, _SC_SIGNALS
},
824 #if defined (_SC_SINGLE_PROCESS)
825 { "_POSIX_SINGLE_PROCESS", SYSCONF
, _SC_SINGLE_PROCESS
},
827 #if defined (_SC_SPAWN)
828 { "_POSIX_SPAWN", SYSCONF
, _SC_SPAWN
},
830 #if defined (_SC_SPIN_LOCKS)
831 { "_POSIX_SPIN_LOCKS", SYSCONF
, _SC_SPIN_LOCKS
},
833 #if defined (_SC_SPORADIC_SERVER)
834 { "_POSIX_SPORADIC_SERVER", SYSCONF
, _SC_SPORADIC_SERVER
},
836 #if defined (_SC_SYMLOOP_MAX)
837 { "_POSIX_SYMLOOP_MAX", SYSCONF
, _SC_SYMLOOP_MAX
},
839 #if defined (_SC_SYNCHRONIZED_IO)
840 { "_POSIX_SYNCHRONIZED_IO", SYSCONF
, _SC_SYNCHRONIZED_IO
},
842 #if defined (_SC_SYSTEM_DATABASE)
843 { "_POSIX_SYSTEM_DATABASE", SYSCONF
, _SC_SYSTEM_DATABASE
},
845 #if defined (_SC_SYSTEM_DATABASE_R)
846 { "_POSIX_SYSTEM_DATABASE_R", SYSCONF
, _SC_SYSTEM_DATABASE_R
},
848 #if defined (_SC_THREAD_ATTR_STACKADDR)
849 { "_POSIX_THREAD_ATTR_STACKADDR", SYSCONF
, _SC_THREAD_ATTR_STACKADDR
},
851 #if defined (_SC_THREAD_ATTR_STACKSIZE)
852 { "_POSIX_THREAD_ATTR_STACKSIZE", SYSCONF
, _SC_THREAD_ATTR_STACKSIZE
},
854 #if defined (_SC_THREAD_CPUTIME)
855 { "_POSIX_THREAD_CPUTIME", SYSCONF
, _SC_THREAD_CPUTIME
},
857 #if defined (_SC_THREAD_PRIO_INHERIT)
858 { "_POSIX_THREAD_PRIO_INHERIT", SYSCONF
, _SC_THREAD_PRIO_INHERIT
},
860 #if defined (_SC_THREAD_PRIO_PROTECT)
861 { "_POSIX_THREAD_PRIO_PROTECT", SYSCONF
, _SC_THREAD_PRIO_PROTECT
},
863 #if defined (_SC_THREAD_PRIORITY_SCHEDULING)
864 { "_POSIX_THREAD_PRIORITY_SCHEDULING", SYSCONF
, _SC_THREAD_PRIORITY_SCHEDULING
},
866 #if defined (_SC_THREAD_PROCESS_SHARED)
867 { "_POSIX_THREAD_PROCESS_SHARED", SYSCONF
, _SC_THREAD_PROCESS_SHARED
},
869 #if defined (_SC_THREAD_SAFE_FUNCTIONS)
870 { "_POSIX_THREAD_SAFE_FUNCTIONS", SYSCONF
, _SC_THREAD_SAFE_FUNCTIONS
},
872 #if defined (_SC_THREAD_SPORADIC_SERVER)
873 { "_POSIX_THREAD_SPORADIC_SERVER", SYSCONF
, _SC_THREAD_SPORADIC_SERVER
},
875 #if defined (_SC_THREADS)
876 { "_POSIX_THREADS", SYSCONF
, _SC_THREADS
},
878 #if defined (_SC_TIMEOUTS)
879 { "_POSIX_TIMEOUTS", SYSCONF
, _SC_TIMEOUTS
},
881 #if defined (_SC_TIMERS)
882 { "_POSIX_TIMERS", SYSCONF
, _SC_TIMERS
},
884 #if defined (_SC_TRACE)
885 { "_POSIX_TRACE", SYSCONF
, _SC_TRACE
},
887 #if defined (_SC_TRACE)
888 { "_POSIX_TRACE_EVENT_FILTER",SYSCONF
, _SC_TRACE_EVENT_FILTER
},
890 #if defined (_SC_TRACE)
891 { "_POSIX_TRACE_INHERIT", SYSCONF
, _SC_TRACE_INHERIT
},
893 #if defined (_SC_TRACE)
894 { "_POSIX_TRACE_LOG", SYSCONF
, _SC_TRACE_LOG
},
896 #if defined (_SC_TYPED_MEMORY_OBJECTS)
897 { "_POSIX_TYPED_MEMORY_OBJECTS", SYSCONF
, _SC_TYPED_MEMORY_OBJECTS
},
899 #if defined (_SC_VERSION)
900 { "_POSIX_VERSION", SYSCONF
, _SC_VERSION
},
903 /* XPG 4.2 Configurable System Variables. */
904 #if defined (_SC_ATEXIT_MAX)
905 { "ATEXIT_MAX", SYSCONF
, _SC_ATEXIT_MAX
},
907 #if defined (_SC_GETGR_R_SIZE_MAX)
908 { "GETGR_R_SIZE_MAX", SYSCONF
, _SC_GETGR_R_SIZE_MAX
},
910 #if defined (_SC_GETPW_R_SIZE_MAX)
911 { "GETPW_R_SIZE_MAX", SYSCONF
, _SC_GETPW_R_SIZE_MAX
},
913 #if defined (_SC_HOST_NAME_MAX)
914 { "HOST_NAME_MAX", SYSCONF
, _SC_HOST_NAME_MAX
},
916 #if defined (_SC_IOV_MAX)
917 { "IOV_MAX", SYSCONF
, _SC_IOV_MAX
},
919 #if defined (_SC_LOGIN_NAME_MAX)
920 { "LOGIN_NAME_MAX", SYSCONF
, _SC_LOGIN_NAME_MAX
},
922 #if defined (_SC_LOGNAME_MAX)
923 { "LOGNAME_MAX", SYSCONF
, _SC_LOGNAME_MAX
},
925 #if defined (_SC_PAGESIZE)
926 { "PAGESIZE", SYSCONF
, _SC_PAGESIZE
},
928 #if defined (_SC_PAGE_SIZE)
929 { "PAGE_SIZE", SYSCONF
, _SC_PAGE_SIZE
},
931 #if defined (_SC_SYMLOOP_MAX)
932 { "SYMLOOP_MAX", SYSCONF
, _SC_SYMLOOP_MAX
},
934 #if defined (_SC_TTY_NAME_MAX)
935 { "TTY_NAME_MAX", SYSCONF
, _SC_TTY_NAME_MAX
},
937 #if defined (_SC_USER_GROUPS)
938 { "_POSIX_USER_GROUPS", SYSCONF
, _SC_USER_GROUPS
},
940 #if defined (_SC_USER_GROUPS_R)
941 { "_POSIX_USER_GROUPS_R", SYSCONF
, _SC_USER_GROUPS_R
},
944 #if defined (_SC_AIO_LISTIO_MAX)
945 { "AIO_LISTIO_MAX", SYSCONF
, _SC_AIO_LISTIO_MAX
},
947 #if defined (_SC_AIO_MAX)
948 { "AIO_MAX", SYSCONF
, _SC_AIO_MAX
},
950 #if defined (_SC_AIO_PRIO_DELTA_MAX)
951 { "AIO_PRIO_DELTA_MAX", SYSCONF
, _SC_AIO_PRIO_DELTA_MAX
},
953 #if defined (_SC_MQ_OPEN_MAX)
954 { "MQ_OPEN_MAX", SYSCONF
, _SC_MQ_OPEN_MAX
},
956 #if defined (_SC_MQ_PRIO_MAX)
957 { "MQ_PRIO_MAX", SYSCONF
, _SC_MQ_PRIO_MAX
},
959 #if defined (_SC_RTSIG_MAX)
960 { "RTSIG_MAX", SYSCONF
, _SC_RTSIG_MAX
},
962 #if defined (_SC_SEM_NSEMS_MAX)
963 { "SEM_NSEMS_MAX", SYSCONF
, _SC_SEM_NSEMS_MAX
},
965 #if defined (_SC_SEM_VALUE_MAX)
966 { "SEM_VALUE_MAX", SYSCONF
, _SC_SEM_VALUE_MAX
},
968 #if defined (_SC_SIGQUEUE_MAX)
969 { "SIGQUEUE_MAX", SYSCONF
, _SC_SIGQUEUE_MAX
},
971 #if defined (_SC_TIMER_MAX)
972 { "TIMER_MAX", SYSCONF
, _SC_TIMER_MAX
},
975 #if defined (_SC_THREAD_DESTRUCTOR_ITERATIONS)
976 { "PTHREAD_DESTRUCTOR_ITERATIONS", SYSCONF
, _SC_THREAD_DESTRUCTOR_ITERATIONS
},
978 #if defined (_SC_THREAD_KEYS_MAX)
979 { "PTHREAD_KEYS_MAX", SYSCONF
, _SC_THREAD_KEYS_MAX
},
981 #if defined (_SC_THREAD_STACK_MIN)
982 { "PTHREAD_STACK_MIN", SYSCONF
, _SC_THREAD_STACK_MIN
},
984 #if defined (_SC_THREAD_THREADS_MAX)
985 { "PTHREAD_THREADS_MAX", SYSCONF
, _SC_THREAD_THREADS_MAX
},
988 /* XPG 4.2 (and later) Optional Facility Configuration Values */
989 #if defined (_SC_XOPEN_CRYPT)
990 { "_XOPEN_CRYPT", SYSCONF
, _SC_XOPEN_CRYPT
},
992 #if defined (_SC_XOPEN_ENH_I18N)
993 { "_XOPEN_ENH_I18N", SYSCONF
, _SC_XOPEN_ENH_I18N
},
995 #if defined (_SC_XOPEN_LEGACY)
996 { "_XOPEN_LEGACY", SYSCONF
, _SC_XOPEN_LEGACY
},
997 #endif /* _SC_XOPEN_LEGACY */
998 #if defined (_SC_XOPEN_REALTIME)
999 { "_XOPEN_REALTIME", SYSCONF
, _SC_XOPEN_REALTIME
},
1001 #if defined (_SC_XOPEN_REALTIME_THREADS)
1002 { "_XOPEN_REALTIME_THREADS", SYSCONF
, _SC_XOPEN_REALTIME_THREADS
},
1004 #if defined (_SC_XOPEN_SHM)
1005 { "_XOPEN_SHM", SYSCONF
, _SC_XOPEN_SHM
},
1007 #if defined (_SC_XOPEN_STREAMS)
1008 { "_XOPEN_STREAMS", SYSCONF
, _SC_XOPEN_STREAMS
},
1010 #if defined (_SC_XOPEN_UNIX)
1011 { "_XOPEN_UNIX", SYSCONF
, _SC_XOPEN_UNIX
},
1013 #if defined (_SC_XOPEN_VERSION)
1014 { "_XOPEN_VERSION", SYSCONF
, _SC_XOPEN_VERSION
},
1016 #if defined (_SC_XOPEN_XCU_VERSION)
1017 { "_XOPEN_XCU_VERSION", SYSCONF
, _SC_XOPEN_XCU_VERSION
},
1019 #if defined (_SC_XOPEN_XPG2)
1020 { "_XOPEN_XPG2", SYSCONF
, _SC_XOPEN_XPG2
},
1022 #if defined (_SC_XOPEN_XPG3)
1023 { "_XOPEN_XPG3", SYSCONF
, _SC_XOPEN_XPG3
},
1025 #if defined (_SC_XOPEN_XPG4)
1026 { "_XOPEN_XPG4", SYSCONF
, _SC_XOPEN_XPG4
},
1028 #if defined (_SC_XOPEN_XPG5)
1029 { "_XOPEN_XPG5", SYSCONF
, _SC_XOPEN_XPG5
},
1032 /* POSIX.1 Configurable Pathname Values */
1034 { "LINK_MAX", PATHCONF
, _PC_LINK_MAX
},
1036 #ifdef _PC_MAX_CANON
1037 { "MAX_CANON", PATHCONF
, _PC_MAX_CANON
},
1039 #ifdef _PC_MAX_INPUT
1040 { "MAX_INPUT", PATHCONF
, _PC_MAX_INPUT
},
1043 { "NAME_MAX", PATHCONF
, _PC_NAME_MAX
},
1046 { "PATH_MAX", PATHCONF
, _PC_PATH_MAX
},
1049 { "PIPE_BUF", PATHCONF
, _PC_PIPE_BUF
},
1051 #ifdef _PC_SYMLINK_MAX
1052 { "SYMLINK_MAX", PATHCONF
, _PC_SYMLINK_MAX
},
1054 #ifdef _PC_CHOWN_RESTRICTED
1055 { "_POSIX_CHOWN_RESTRICTED", PATHCONF
, _PC_CHOWN_RESTRICTED
},
1058 { "_POSIX_NO_TRUNC", PATHCONF
, _PC_NO_TRUNC
},
1061 { "_POSIX_VDISABLE", PATHCONF
, _PC_VDISABLE
},
1064 /* XPG 4.2 Configurable Pathname Values */
1065 #if defined (_PC_FILESIZEBITS)
1066 { "FILESIZEBITS", PATHCONF
, _PC_FILESIZEBITS
},
1068 #if defined (_PC_ASYNC_IO)
1069 { "_POSIX_ASYNC_IO", PATHCONF
, _PC_ASYNC_IO
},
1071 #if defined (_PC_PRIO_IO)
1072 { "_POSIX_PRIO_IO", PATHCONF
, _PC_PRIO_IO
},
1074 #if defined (_PC_SYNC_IO)
1075 { "_POSIX_SYNC_IO", PATHCONF
, _PC_SYNC_IO
},
1078 /* POSIX.1-200x configurable pathname values */
1079 #if defined (_PC_ALLOC_SIZE_MIN)
1080 { "POSIX_ALLOC_SIZE_MIN", PATHCONF
, _PC_ALLOC_SIZE_MIN
},
1081 { "POSIX_REC_INCR_XFER_SIZE", PATHCONF
, _PC_REC_INCR_XFER_SIZE
},
1082 { "POSIX_REC_MAX_XFER_SIZE", PATHCONF
, _PC_REC_MAX_XFER_SIZE
},
1083 { "POSIX_REC_MIN_XFER_SIZE", PATHCONF
, _PC_REC_MIN_XFER_SIZE
},
1084 { "POSIX_REC_XFER_ALIGN", PATHCONF
, _PC_REC_XFER_ALIGN
},
1087 /* ANSI/ISO C, POSIX.1-200x, XPG 4.2 (and later) C language type limits. */
1088 { "CHAR_BIT", CONSTANT
, CHAR_BIT
},
1089 { "CHAR_MAX", CONSTANT
, CHAR_MAX
},
1090 { "CHAR_MIN", CONSTANT
, CHAR_MIN
},
1091 { "INT_BIT", CONSTANT
, INT_BIT
},
1092 { "INT_MAX", CONSTANT
, INT_MAX
},
1093 { "INT_MIN", CONSTANT
, INT_MIN
},
1095 { "LLONG_MAX", LLCONST
, VAL_LLONG_MAX
},
1096 { "LLONG_MIN", LLCONST
, VAL_LLONG_MIN
},
1098 { "LONG_BIT", CONSTANT
, LONG_BIT
},
1099 { "LONG_MAX", CONSTANT
, LONG_MAX
},
1100 { "LONG_MIN", CONSTANT
, LONG_MIN
},
1102 { "MB_LEN_MAX", CONSTANT
, MB_LEN_MAX
},
1104 { "SCHAR_MAX", CONSTANT
, SCHAR_MAX
},
1105 { "SCHAR_MIN", CONSTANT
, SCHAR_MIN
},
1106 { "SHRT_MAX", CONSTANT
, SHRT_MAX
},
1107 { "SHRT_MIN", CONSTANT
, SHRT_MIN
},
1108 { "SIZE_MAX", CONSTANT
, SIZE_MAX
},
1109 { "SSIZE_MAX", CONSTANT
, SSIZE_MAX
},
1110 { "UCHAR_MAX", CONSTANT
, UCHAR_MAX
},
1111 { "UINT_MAX", CONSTANT
, UINT_MAX
},
1113 { "ULLONG_MAX", LLCONST
, VAL_ULLONG_MAX
},
1115 { "ULONG_MAX", CONSTANT
, ULONG_MAX
},
1116 { "USHRT_MAX", CONSTANT
, USHRT_MAX
},
1117 { "WORD_BIT", CONSTANT
, WORD_BIT
},
1122 static int num_getconf_variables
= sizeof(conf_table
) / sizeof(struct conf_variable
) - 1;
1124 extern char *this_command_name
;
1125 extern char **make_builtin_argv ();
1127 static void getconf_help ();
1128 static int getconf_print ();
1129 static int getconf_one ();
1130 static int getconf_all ();
1133 getconf_builtin (list
)
1136 int c
, r
, opt
, aflag
;
1140 reset_internal_getopt();
1141 while ((opt
= internal_getopt (list
, "ahv:")) != -1) {
1148 return(EXECUTION_SUCCESS
);
1150 break; /* ignored */
1158 if ((aflag
== 0 && list
== 0) || (aflag
&& list
) || list_length(list
) > 2) {
1163 r
= aflag
? getconf_all() : getconf_one(list
);
1171 const struct conf_variable
*cp
;
1172 register int i
, column
;
1175 printf("Acceptable variable names are:\n");
1176 for (cp
= conf_table
; cp
->name
!= NULL
; cp
++) {
1177 if (cp
->type
== PATHCONF
)
1178 printf("%s pathname\n", cp
->name
);
1180 printf("%s\n", cp
->name
);
1185 getconf_print(cp
, vpath
, all
)
1186 struct conf_variable
*cp
;
1196 printf("undefined\n");
1201 switch (cp
->value
) {
1204 printf ("%lld\n", LLONG_MIN
);
1207 printf ("%lld\n", LLONG_MAX
);
1209 # if (ULLONG_MAX != LLONG_MAX)
1210 case VAL_ULLONG_MAX
:
1211 printf ("%llu\n", ULLONG_MAX
);
1218 switch (cp
->value
) {
1222 #if (ULONG_MAX != UINT_MAX)
1225 #if (SIZE_MAX != UINT_MAX) && (SIZE_MAX != ULONG_MAX)
1229 printf("%lu\n", cp
->value
);
1232 printf("%ld\n", cp
->value
);
1239 slen
= confstr (cp
->value
, (char *) 0, (size_t) 0);
1243 printf ("getconf: %s\n", strerror(errno
));
1245 builtin_error ("%s", strerror(errno
));
1247 printf ("undefined\n");
1248 return (EXECUTION_FAILURE
);
1250 sval
= xmalloc(slen
);
1252 confstr(cp
->value
, sval
, slen
);
1253 printf("%s\n", sval
);
1259 if ((val
= sysconf(cp
->value
)) == -1) {
1262 printf("getconf: %s\n", strerror (errno
));
1264 builtin_error ("%s", strerror (errno
));
1265 return (EXECUTION_FAILURE
);
1268 printf ("undefined\n");
1270 printf("%ld\n", val
);
1276 if ((val
= pathconf(vpath
, cp
->value
)) == -1) {
1279 printf("getconf: %s: %s\n", vpath
, strerror (errno
));
1281 builtin_error ("%s: %s", vpath
, strerror (errno
));
1282 return (EXECUTION_FAILURE
);
1285 printf ("undefined\n");
1287 printf ("%ld\n", val
);
1292 return (ferror(stdout
) ? EXECUTION_FAILURE
: EXECUTION_SUCCESS
);
1298 const struct conf_variable
*cp
;
1301 ret
= EXECUTION_SUCCESS
;
1302 for (cp
= conf_table
; cp
->name
!= NULL
; cp
++) {
1303 printf("%-35s", cp
->name
);
1304 if (getconf_print(cp
, "/", 1) == EXECUTION_FAILURE
)
1305 ret
= EXECUTION_FAILURE
;
1314 const struct conf_variable
*cp
;
1315 char *vname
, *vpath
;
1317 vname
= list
->word
->word
;
1318 vpath
= (list
->next
&& list
->next
->word
) ? list
->next
->word
->word
1321 for (cp
= conf_table
; cp
->name
!= NULL
; cp
++) {
1322 if (strcmp(vname
, cp
->name
) == 0)
1325 if (cp
->name
== NULL
) {
1326 builtin_error ("%s: unknown variable", vname
);
1327 return (EXECUTION_FAILURE
);
1330 if (cp
->type
== PATHCONF
) {
1331 if (list
->next
== 0) {
1342 return (getconf_print(cp
, vpath
, 0));
1345 static char *getconf_doc
[] = {
1346 "Display values of system limits and options.",
1348 "getconf writes the current value of a configurable system limit or",
1349 "option variable to the standard output.",
1353 struct builtin getconf_struct
= {
1358 "getconf -[ah] or getconf [-v spec] sysvar or getconf [-v spec] pathvar pathname",
1362 #ifndef HAVE_CONFSTR
1364 confstr (name
, buf
, len
)
1374 strncpy (buf
, STANDARD_UTILS_PATH
, len
- 1);
1375 buf
[len
- 1] = '\0';
1377 return (sizeof (STANDARD_UTILS_PATH
) + 1);
1385 #ifndef HAVE_SYSCONF
1386 extern long get_clk_tck
__P((void));
1392 # if defined (_POSIX_VERSION)
1396 return _POSIX_ARG_MAX
;
1398 return _POSIX_CHILD_MAX
;
1400 return get_clk_tck();
1401 case _SC_NGROUPS_MAX
:
1402 return _POSIX_NGROUPS_MAX
;
1404 return _POSIX_OPEN_MAX
;
1405 case _SC_JOB_CONTROL
:
1406 return _POSIX_JOB_CONTROL
;
1408 return _POSIX_SAVED_IDS
;
1410 return _POSIX_VERSION
;
1411 case _SC_BC_BASE_MAX
:
1412 return _POSIX2_BC_BASE_MAX
;
1413 case _SC_BC_DIM_MAX
:
1414 return _POSIX2_BC_DIM_MAX
;
1415 case _SC_BC_SCALE_MAX
:
1416 return _POSIX2_BC_SCALE_MAX
;
1417 case _SC_BC_STRING_MAX
:
1418 return _POSIX2_BC_STRING_MAX
;
1419 case _SC_COLL_WEIGHTS_MAX
:
1421 case _SC_EXPR_NEST_MAX
:
1422 return _POSIX2_EXPR_NEST_MAX
;
1424 return _POSIX2_LINE_MAX
;
1425 case _SC_RE_DUP_MAX
:
1426 return _POSIX2_RE_DUP_MAX
;
1427 case _SC_STREAM_MAX
:
1428 return _POSIX_STREAM_MAX
;
1429 case _SC_TZNAME_MAX
:
1430 return _POSIX_TZNAME_MAX
;
1442 #ifndef HAVE_PATHCONF
1444 pathconf (path
, name
)
1448 #if defined (_POSIX_VERSION)
1452 return _POSIX_LINK_MAX
;
1454 return _POSIX_MAX_CANON
;
1456 return _POSIX_MAX_INPUT
;
1458 return _POSIX_NAME_MAX
;
1460 return _POSIX_PATH_MAX
;
1462 return _POSIX_PIPE_BUF
;
1463 case _PC_CHOWN_RESTRICTED
:
1464 #ifdef _POSIX_CHOWN_RESTRICTED
1465 return _POSIX_CHOWN_RESTRICTED
;
1470 #ifdef _POSIX_NO_TRUNC
1471 return _POSIX_NO_TRUNC
;
1476 #ifdef _POSIX_VDISABLE
1477 return _POSIX_VDISABLE
;