1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 1985, 1993 by Mortice Kern Systems Inc. All rights reserved.
29 *
30 */
31
32 /* from OpenSolaris "getconf.c 1.14 05/06/08 SMI" */
33
34 /*
35 * Portions Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany
36 */
37 #if __GNUC__ >= 3 && __GNUC_MINOR__ >= 4 || __GNUC__ >= 4
38 #define USED __attribute__ ((used))
39 #elif defined __GNUC__
40 #define USED __attribute__ ((unused))
41 #else
42 #define USED
43 #endif
44 #if defined (SU3)
45 static const char sccsid[] USED = "@(#)getconf_su3.sl 1.14 (gritter) 01/27/07";
46 #else /* !SU3 */
47 static const char sccsid[] USED = "@(#)getconf.sl 1.14 (gritter) 01/27/07";
48 #endif /* !SU3 */
49
50 /*
51 * getconf -- POSIX.2 compatible utility to query configuration specific
52 * parameters.
53 * -- XPG4 support added June/93
54 *
55 * -- XPG5 support added Dec/97
56 *
57 * -- XPG6 support added May/2003
58 */
59
60 #include <stdio.h>
61 #include <stdlib.h>
62 #include <string.h>
63 #include <errno.h>
64 #include <unistd.h>
65 #include <limits.h>
66 #include <libgen.h>
67
68 /*
69 * Values applicable for the Heirloom Toolchest that partially
70 * override those of the host platform.
71 */
72 #undef POSIX2_VERSION
73 #undef _XOPEN_XCU_VERSION
74 #if defined (SU3)
75 #define HEIRLOOM_PATH SU3BIN ":" DEFBIN ":" CCSBIN ":" UCBBIN
76 #define POSIX2_VERSION 200112
77 #define _XOPEN_XCU_VERSION 600
78 #else /* !SU3 */
79 #define HEIRLOOM_PATH SUSBIN ":" DEFBIN ":" CCSBIN ":" UCBBIN
80 #define POSIX2_VERSION 199209
81 #define _XOPEN_XCU_VERSION 4
82 #endif /* !SU3 */
83
84 #ifndef BC_BASE_MAX
85 #define BC_BASE_MAX 99
86 #endif
87 #ifndef BC_DIM_MAX
88 #define BC_DIM_MAX 2048
89 #endif
90 #undef BC_SCALE_MAX
91 #define BC_SCALE_MAX 99
92 #undef BC_STRING_MAX
93 #define BC_STRING_MAX 1000
94 #undef EXPR_NEST_MAX
95 #define EXPR_NEST_MAX 32
96 #ifndef LINE_MAX
97 #define LINE_MAX 2048
98 #endif
99 #undef RE_DUP_MAX
100 #define RE_DUP_MAX 255
101 #undef POSIX2_UPE
102 #define POSIX2_UPE 1
103
104 #include "heirloom.h"
105
106 /*
107 * POSIX invariants, defined in case the host system does not provide
108 * them, or to override possible wrong definitions.
109 */
110 #undef _POSIX_AIO_LISTIO_MAX
111 #define _POSIX_AIO_LISTIO_MAX 2
112 #undef _POSIX_AIO_MAX
113 #define _POSIX_AIO_MAX 1
114 #undef _POSIX_ARG_MAX
115 #define _POSIX_ARG_MAX 4096
116 #undef _POSIX_CHILD_MAX
117 #if defined (SU3)
118 #define _POSIX_CHILD_MAX 25
119 #else /* !SU3 */
120 #define _POSIX_CHILD_MAX 6
121 #endif /* !SU3 */
122 #undef _POSIX_CLOCKRES_MIN
123 #define _POSIX_CLOCKRES_MIN 20000000
124 #undef _POSIX_DELAYTIMER_MAX
125 #define _POSIX_DELAYTIMER_MAX 32
126 #undef _POSIX_HOST_NAME_MAX
127 #define _POSIX_HOST_NAME_MAX 255
128 #undef _POSIX_LINK_MAX
129 #define _POSIX_LINK_MAX 8
130 #undef _POSIX_LOGIN_NAME_MAX
131 #define _POSIX_LOGIN_NAME_MAX 9
132 #undef _POSIX_MAX_CANON
133 #define _POSIX_MAX_CANON 255
134 #undef _POSIX_MAX_INPUT
135 #define _POSIX_MAX_INPUT 255
136 #undef _POSIX_MQ_OPEN_MAX
137 #define _POSIX_MQ_OPEN_MAX 8
138 #undef _POSIX_MQ_PRIO_MAX
139 #define _POSIX_MQ_PRIO_MAX 32
140 #undef _POSIX_NAME_MAX
141 #define _POSIX_NAME_MAX 14
142 #undef _POSIX_NGROUPS_MAX
143 #if defined (SU3)
144 #define _POSIX_NGROUPS_MAX 8
145 #else /* !SU3 */
146 #define _POSIX_NGROUPS_MAX 0
147 #endif
148 #undef _POSIX_OPEN_MAX
149 #if defined (SU3)
150 #define _POSIX_OPEN_MAX 20
151 #else /* !SU3 */
152 #define _POSIX_OPEN_MAX 16
153 #endif
154 #undef _POSIX_PATH_MAX
155 #if defined (SU3)
156 #define _POSIX_PATH_MAX 256
157 #else /* !SU3 */
158 #define _POSIX_PATH_MAX 255
159 #endif /* !SU3 */
160 #undef _POSIX_PIPE_BUF
161 #define _POSIX_PIPE_BUF 512
162 #undef _POSIX_RE_DUP_MAX
163 #define _POSIX_RE_DUP_MAX 255
164 #undef _POSIX_RTSIG_MAX
165 #define _POSIX_RTSIG_MAX 8
166 #undef _POSIX_SEM_NSEMS_MAX
167 #define _POSIX_SEM_NSEMS_MAX 256
168 #undef _POSIX_SEM_VALUE_MAX
169 #define _POSIX_SEM_VALUE_MAX 32767
170 #undef _POSIX_SIGQUEUE_MAX
171 #define _POSIX_SIGQUEUE_MAX 32
172 #undef _POSIX_SSIZE_MAX
173 #define _POSIX_SSIZE_MAX 32767
174 #undef _POSIX_STREAM_MAX
175 #define _POSIX_STREAM_MAX 8
176 #undef _POSIX_SYMLINK_MAX
177 #define _POSIX_SYMLINK_MAX 255
178 #undef _POSIX_SYMLOOP_MAX
179 #define _POSIX_SYMLOOP_MAX 8
180 #undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
181 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
182 #undef _POSIX_THREAD_KEYS_MAX
183 #define _POSIX_THREAD_KEYS_MAX 128
184 #undef _POSIX_THREAD_THREADS_MAX
185 #define _POSIX_THREAD_THREADS_MAX 64
186 #undef _POSIX_TIMER_MAX
187 #define _POSIX_TIMER_MAX 32
188 #undef _POSIX_TTY_NAME_MAX
189 #define _POSIX_TTY_NAME_MAX 9
190 #undef _POSIX_TZNAME_MAX
191 #if defined (SU3)
192 #define _POSIX_TZNAME_MAX 6
193 #else /* !SU3 */
194 #define _POSIX_TZNAME_MAX 3
195 #endif /* !SU3 */
196 #undef _POSIX2_BC_BASE_MAX
197 #define _POSIX2_BC_BASE_MAX 99
198 #undef _POSIX2_BC_DIM_MAX
199 #define _POSIX2_BC_DIM_MAX 2048
200 #undef _POSIX2_BC_SCALE_MAX
201 #define _POSIX2_BC_SCALE_MAX 99
202 #undef _POSIX2_BC_STRING_MAX
203 #define _POSIX2_BC_STRING_MAX 1000
204 #undef _POSIX2_CHARCLASS_NAME_MAX
205 #define _POSIX2_CHARCLASS_NAME_MAX 14
206 #undef _POSIX2_COLL_WEIGHTS_MAX
207 #define _POSIX2_COLL_WEIGHTS_MAX 2
208 #undef _POSIX2_EXPR_NEST_MAX
209 #define _POSIX2_EXPR_NEST_MAX 32
210 #undef _POSIX2_LINE_MAX
211 #define _POSIX2_LINE_MAX 2048
212 #undef _POSIX2_RE_DUP_MAX
213 #define _POSIX2_RE_DUP_MAX 255
214 #undef _XOPEN_IOV_MAX
215 #define _XOPEN_IOV_MAX 16
216 #undef _XOPEN_NAME_MAX
217 #define _XOPEN_NAME_MAX 255
218 #undef _XOPEN_PATH_MAX
219 #define _XOPEN_PATH_MAX 1024
220
221 extern size_t confstr(int, char *, size_t);
222
223 static int aflag = 0;
224
225 static const char *progname;
226
227 #define INVAL_ARG "%s: Invalid argument (%s)\n"
228 #define INVAL_PATHARG "%s: Invalid argument (%s or %s)\n"
229
230 /*
231 * Notes:
232 * The sctab.value field is defined to be a long.
233 * There are some values that are "unsigned long"; these values
234 * can be stored in a "long" field but when output, must be printed
235 * as an unsigned value. Thus, these values must have UNSIGNED_VALUE bit
236 * set in sctab.flag field.
237 *
238 * There are 2 different ways to indicate a symbol is undefined:
239 * 1) sctab.flag = UNDEFINED
240 * 2) or sctab.value = -1 (and if !UNDEFINED and !UNSIGNED_VALUE)
241 *
242 * There are a group of symbols (e.g CHAR_MIN, INT_MAX, INT_MIN, LONG_BIT ...)
243 * which we may set to -1 if they are not pre-defined in a system header file.
244 * This is used to indicate that these symbols are "undefined".
245 * We are assuming that these symbols cannot reasonably have a value of -1
246 * if they were defined in a system header file.
247 * (Unless of course -1 can be used to indicate "undefined" for that symbol)
248 */
249
250 static struct sctab {
251 long value;
252 char *name;
253 enum { SELFCONF, SYSCONF, PATHCONF, CONFSTR, PATHVAR } type;
254 int flag;
255 long dfl;
256 /* bit fields for sctab.flag member */
257 #define NOFLAGS 0 /* no special indicators */
258 #define UNDEFINED 1 /* value is known undefined at compile time */
259 #define UNSIGNED_VALUE 2 /* value is an unsigned */
260 } sctab[] = {
261 /*
262 * Some entries in this structure have both leading _ and non leading _
263 * versions for compatibility with various versions of the specifications.
264 * It is not expected that both forms will be required for new entries.
265 */
266
267 /* POSIX.2-1992 table 2-17 */
268 {
269 _POSIX2_BC_BASE_MAX, "POSIX2_BC_BASE_MAX", SELFCONF, NOFLAGS
270 },
271 {
272 _POSIX2_BC_BASE_MAX, "_POSIX2_BC_BASE_MAX", SELFCONF, NOFLAGS
273 },
274 {
275 _POSIX2_BC_DIM_MAX, "POSIX2_BC_DIM_MAX", SELFCONF, NOFLAGS
276 },
277 {
278 _POSIX2_BC_DIM_MAX, "_POSIX2_BC_DIM_MAX", SELFCONF, NOFLAGS
279 },
280 {
281 _POSIX2_BC_SCALE_MAX, "POSIX2_BC_SCALE_MAX", SELFCONF, NOFLAGS
282 },
283 {
284 _POSIX2_BC_SCALE_MAX, "_POSIX2_BC_SCALE_MAX", SELFCONF, NOFLAGS
285 },
286 {
287 _POSIX2_BC_STRING_MAX, "POSIX2_BC_STRING_MAX", SELFCONF, NOFLAGS
288 },
289 {
290 _POSIX2_BC_STRING_MAX, "_POSIX2_BC_STRING_MAX", SELFCONF, NOFLAGS
291 },
292 {
293 _POSIX2_COLL_WEIGHTS_MAX, "POSIX2_COLL_WEIGHTS_MAX", SELFCONF, NOFLAGS
294 },
295 {
296 _POSIX2_COLL_WEIGHTS_MAX, "_POSIX2_COLL_WEIGHTS_MAX", SELFCONF, NOFLAGS
297 },
298 {
299 _POSIX2_EXPR_NEST_MAX, "POSIX2_EXPR_NEST_MAX", SELFCONF, NOFLAGS
300 },
301 {
302 _POSIX2_EXPR_NEST_MAX, "_POSIX2_EXPR_NEST_MAX", SELFCONF, NOFLAGS
303 },
304 {
305 _POSIX2_LINE_MAX, "POSIX2_LINE_MAX", SELFCONF, NOFLAGS
306 },
307 {
308 _POSIX2_LINE_MAX, "_POSIX2_LINE_MAX", SELFCONF, NOFLAGS
309 },
310 {
311 _POSIX2_RE_DUP_MAX, "POSIX2_RE_DUP_MAX", SELFCONF, NOFLAGS
312 },
313 {
314 _POSIX2_RE_DUP_MAX, "_POSIX2_RE_DUP_MAX", SELFCONF, NOFLAGS
315 },
316 /* See limits.h section below for _POSIX_RE_DUP_MAX */
317
318 /* UNIX 98 */
319 {
320 _POSIX_AIO_LISTIO_MAX, "_POSIX_AIO_LISTIO_MAX", SELFCONF, NOFLAGS
321 },
322 {
323 _POSIX_AIO_MAX, "_POSIX_AIO_MAX", SELFCONF, NOFLAGS
324 },
325 {
326 _POSIX_DELAYTIMER_MAX, "_POSIX_DELAYTIMER_MAX", SELFCONF, NOFLAGS
327 },
328 {
329 _POSIX_LOGIN_NAME_MAX, "_POSIX_LOGIN_NAME_MAX", SELFCONF, NOFLAGS
330 },
331 {
332 _POSIX_MQ_OPEN_MAX, "_POSIX_MQ_OPEN_MAX", SELFCONF, NOFLAGS
333 },
334 {
335 _POSIX_MQ_PRIO_MAX, "_POSIX_MQ_PRIO_MAX", SELFCONF, NOFLAGS
336 },
337 {
338 _POSIX_RTSIG_MAX, "_POSIX_RTSIG_MAX", SELFCONF, NOFLAGS
339 },
340 {
341 _POSIX_SEM_NSEMS_MAX, "_POSIX_SEM_NSEMS_MAX", SELFCONF, NOFLAGS
342 },
343 {
344 _POSIX_SEM_VALUE_MAX, "_POSIX_SEM_VALUE_MAX", SELFCONF, NOFLAGS
345 },
346 {
347 _POSIX_SIGQUEUE_MAX, "_POSIX_SIGQUEUE_MAX", SELFCONF, NOFLAGS
348 },
349 {
350 _POSIX_TTY_NAME_MAX, "_POSIX_TTY_NAME_MAX", SELFCONF, NOFLAGS
351 },
352
353 /* UNIX 03 */
354 {
355 _POSIX_HOST_NAME_MAX, "_POSIX_HOST_NAME_MAX", SELFCONF, NOFLAGS
356 },
357 {
358 _POSIX_RE_DUP_MAX, "_POSIX_RE_DUP_MAX", SELFCONF, NOFLAGS
359 },
360 {
361 _POSIX_CLOCKRES_MIN, "_POSIX_CLOCKRES_MIN", SELFCONF, NOFLAGS
362 },
363 {
364 _POSIX_SYMLINK_MAX, "_POSIX_SYMLINK_MAX", SELFCONF, NOFLAGS
365 },
366 {
367 _POSIX_SYMLOOP_MAX, "_POSIX_SYMLOOP_MAX", SELFCONF, NOFLAGS
368 },
369 {
370 _POSIX2_CHARCLASS_NAME_MAX, "_POSIX2_CHARCLASS_NAME_MAX", SELFCONF, NOFLAGS
371 },
372
373 /* POSIX.2-1992 table 2-17 */
374 {
375 POSIX2_VERSION, "POSIX2_VERSION", SELFCONF, NOFLAGS
376 },
377 {
378 POSIX2_VERSION, "_POSIX2_VERSION", SELFCONF, NOFLAGS
379 },
380
381 /* POSIX.2-1992 table 2-18 */
382 {
383 BC_BASE_MAX, "BC_BASE_MAX", SELFCONF, NOFLAGS
384 },
385 {
386 BC_DIM_MAX, "BC_DIM_MAX", SELFCONF, NOFLAGS
387 },
388 {
389 BC_SCALE_MAX, "BC_SCALE_MAX", SELFCONF, NOFLAGS
390 },
391 {
392 BC_STRING_MAX, "BC_STRING_MAX", SELFCONF, NOFLAGS
393 },
394 #ifdef _SC_COLL_WEIGHTS_MAX
395 {
396 _SC_COLL_WEIGHTS_MAX, "COLL_WEIGHTS_MAX", SYSCONF, NOFLAGS
397 },
398 #endif /* _SC_COLL_WEIGHTS_MAX */
399 {
400 EXPR_NEST_MAX, "EXPR_NEST_MAX", SELFCONF, NOFLAGS
401 },
402 {
403 LINE_MAX, "LINE_MAX", SELFCONF, NOFLAGS
404 },
405 {
406 RE_DUP_MAX, "RE_DUP_MAX", SELFCONF, NOFLAGS
407 },
408
409 /* POSIX.2-1992 table 2-19 */
410 #ifdef _SC_2_C_BIND
411 {
412 _SC_2_C_BIND, "POSIX2_C_BIND", SYSCONF, NOFLAGS
413 },
414 #endif /* _SC_2_C_BIND */
415 #ifdef _SC_2_C_BIND
416 {
417 _SC_2_C_BIND, "_POSIX2_C_BIND", SYSCONF, NOFLAGS
418 },
419 #endif /* _SC_2_C_BIND */
420 #ifdef _SC_2_C_DEV
421 {
422 _SC_2_C_DEV, "POSIX2_C_DEV", SYSCONF, NOFLAGS
423 },
424 #endif /* _SC_2_C_DEV */
425 #ifdef _SC_2_C_DEV
426 {
427 _SC_2_C_DEV, "_POSIX2_C_DEV", SYSCONF, NOFLAGS
428 },
429 #endif /* _SC_2_C_DEV */
430 #ifdef _SC_2_CHAR_TERM
431 {
432 _SC_2_CHAR_TERM, "POSIX2_CHAR_TERM", SYSCONF, NOFLAGS
433 },
434 #endif /* _SC_2_CHAR_TERM */
435 #ifdef _SC_2_CHAR_TERM
436 {
437 _SC_2_CHAR_TERM, "_POSIX2_CHAR_TERM", SYSCONF, NOFLAGS
438 },
439 #endif /* _SC_2_CHAR_TERM */
440 #ifdef _SC_2_FORT_DEV
441 {
442 _SC_2_FORT_DEV, "POSIX2_FORT_DEV", SYSCONF, NOFLAGS
443 },
444 #endif /* _SC_2_FORT_DEV */
445 #ifdef _SC_2_FORT_DEV
446 {
447 _SC_2_FORT_DEV, "_POSIX2_FORT_DEV", SYSCONF, NOFLAGS
448 },
449 #endif /* _SC_2_FORT_DEV */
450 #ifdef _SC_2_FORT_RUN
451 {
452 _SC_2_FORT_RUN, "POSIX2_FORT_RUN", SYSCONF, NOFLAGS
453 },
454 #endif /* _SC_2_FORT_RUN */
455 #ifdef _SC_2_FORT_RUN
456 {
457 _SC_2_FORT_RUN, "_POSIX2_FORT_RUN", SYSCONF, NOFLAGS
458 },
459 #endif /* _SC_2_FORT_RUN */
460 #ifdef _SC_2_LOCALEDEF
461 {
462 _SC_2_LOCALEDEF, "POSIX2_LOCALEDEF", SYSCONF, NOFLAGS
463 },
464 #endif /* _SC_2_LOCALEDEF */
465 #ifdef _SC_2_LOCALEDEF
466 {
467 _SC_2_LOCALEDEF, "_POSIX2_LOCALEDEF", SYSCONF, NOFLAGS
468 },
469 #endif /* _SC_2_LOCALEDEF */
470 #ifdef _SC_2_SW_DEV
471 {
472 _SC_2_SW_DEV, "POSIX2_SW_DEV", SYSCONF, NOFLAGS
473 },
474 #endif /* _SC_2_SW_DEV */
475 #ifdef _SC_2_SW_DEV
476 {
477 _SC_2_SW_DEV, "_POSIX2_SW_DEV", SYSCONF, NOFLAGS
478 },
479 #endif /* _SC_2_SW_DEV */
480 {
481 POSIX2_UPE, "POSIX2_UPE", SELFCONF, NOFLAGS
482 },
483 {
484 POSIX2_UPE, "_POSIX2_UPE", SELFCONF, NOFLAGS
485 },
486
487 /* POSIX.1-1990 table 2-3 */
488 {
489 _POSIX_ARG_MAX, "_POSIX_ARG_MAX", SELFCONF, NOFLAGS
490 },
491 {
492 _POSIX_CHILD_MAX, "_POSIX_CHILD_MAX", SELFCONF, NOFLAGS
493 },
494 {
495 _POSIX_LINK_MAX, "_POSIX_LINK_MAX", SELFCONF, NOFLAGS
496 },
497 {
498 _POSIX_MAX_CANON, "_POSIX_MAX_CANON", SELFCONF, NOFLAGS
499 },
500 {
501 _POSIX_MAX_INPUT, "_POSIX_MAX_INPUT", SELFCONF, NOFLAGS
502 },
503 {
504 _POSIX_NAME_MAX, "_POSIX_NAME_MAX", SELFCONF, NOFLAGS
505 },
506 {
507 _POSIX_NGROUPS_MAX, "_POSIX_NGROUPS_MAX", SELFCONF, NOFLAGS
508 },
509 {
510 _POSIX_OPEN_MAX, "_POSIX_OPEN_MAX", SELFCONF, NOFLAGS
511 },
512 {
513 _POSIX_PATH_MAX, "_POSIX_PATH_MAX", SELFCONF, NOFLAGS
514 },
515 {
516 _POSIX_PIPE_BUF, "_POSIX_PIPE_BUF", SELFCONF, NOFLAGS
517 },
518 {
519 _POSIX_SSIZE_MAX, "_POSIX_SSIZE_MAX", SELFCONF, NOFLAGS
520 },
521 {
522 _POSIX_STREAM_MAX, "_POSIX_STREAM_MAX", SELFCONF, NOFLAGS
523 },
524 {
525 _POSIX_TIMER_MAX, "_POSIX_TIMER_MAX", SELFCONF, NOFLAGS
526 },
527 {
528 _POSIX_THREAD_DESTRUCTOR_ITERATIONS,
529 "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", SELFCONF, NOFLAGS
530 },
531 {
532 _POSIX_THREAD_KEYS_MAX,
533 "_POSIX_THREAD_KEYS_MAX", SELFCONF, NOFLAGS
534 },
535 {
536 _POSIX_THREAD_THREADS_MAX,
537 "_POSIX_THREAD_THREADS_MAX", SELFCONF, NOFLAGS
538 },
539 {
540 _POSIX_TZNAME_MAX, "_POSIX_TZNAME_MAX", SELFCONF, NOFLAGS
541 },
542
543 /* POSIX.1-1990 table 4-2 */
544 #ifdef _SC_ARG_MAX
545 {
546 _SC_ARG_MAX, "ARG_MAX", SYSCONF, NOFLAGS
547 },
548 #endif /* _SC_ARG_MAX */
549 #ifdef _SC_CHILD_MAX
550 {
551 _SC_CHILD_MAX, "CHILD_MAX", SYSCONF, NOFLAGS
552 },
553 #endif /* _SC_CHILD_MAX */
554 #ifdef _SC_CLK_TCK
555 {
556 _SC_CLK_TCK, "CLK_TCK", SYSCONF, NOFLAGS
557 },
558 #endif /* _SC_CLK_TCK */
559 #ifdef _SC_JOB_CONTROL
560 {
561 _SC_JOB_CONTROL, "_POSIX_JOB_CONTROL", SYSCONF, NOFLAGS
562 },
563 #endif /* _SC_JOB_CONTROL */
564 #ifdef _SC_NGROUPS_MAX
565 {
566 _SC_NGROUPS_MAX, "NGROUPS_MAX", SYSCONF, NOFLAGS
567 },
568 #endif /* _SC_NGROUPS_MAX */
569 #ifdef _SC_OPEN_MAX
570 {
571 _SC_OPEN_MAX, "OPEN_MAX", SYSCONF, NOFLAGS
572 },
573 #endif /* _SC_OPEN_MAX */
574 #ifdef _SC_SAVED_IDS
575 {
576 _SC_SAVED_IDS, "_POSIX_SAVED_IDS", SYSCONF, NOFLAGS
577 },
578 #endif /* _SC_SAVED_IDS */
579 #ifdef _SC_STREAM_MAX
580 {
581 _SC_STREAM_MAX, "STREAM_MAX", SYSCONF, NOFLAGS
582 },
583 #endif /* _SC_STREAM_MAX */
584 #ifdef _SC_TZNAME_MAX
585 {
586 _SC_TZNAME_MAX, "TZNAME_MAX", SYSCONF, NOFLAGS
587 },
588 #endif /* _SC_TZNAME_MAX */
589 #ifdef _SC_VERSION
590 {
591 _SC_VERSION, "_POSIX_VERSION", SYSCONF, NOFLAGS
592 },
593 #endif /* _SC_VERSION */
594
595 /* pathconf() variables */
596
597 /* POSIX.1-1990 table 5-2 */
598
599 #ifdef _PC_LINK_MAX
600 {
601 _PC_LINK_MAX, "LINK_MAX", PATHCONF, NOFLAGS
602 },
603 #endif /* _PC_LINK_MAX */
604 #ifdef _PC_MAX_CANON
605 {
606 _PC_MAX_CANON, "MAX_CANON", PATHCONF, NOFLAGS
607 },
608 #endif /* _PC_MAX_CANON */
609 #ifdef _PC_MAX_INPUT
610 {
611 _PC_MAX_INPUT, "MAX_INPUT", PATHCONF, NOFLAGS
612 },
613 #endif /* _PC_MAX_INPUT */
614 #ifdef _PC_NAME_MAX
615 {
616 _PC_NAME_MAX, "NAME_MAX", PATHCONF, NOFLAGS
617 },
618 #endif /* _PC_NAME_MAX */
619 #ifdef _PC_PATH_MAX
620 {
621 _PC_PATH_MAX, "PATH_MAX", PATHCONF, NOFLAGS
622 },
623 #endif /* _PC_PATH_MAX */
624 #ifdef _PC_PIPE_BUF
625 {
626 _PC_PIPE_BUF, "PIPE_BUF", PATHCONF, NOFLAGS
627 },
628 #endif /* _PC_PIPE_BUF */
629 #ifdef _PC_CHOWN_RESTRICTED
630 {
631 _PC_CHOWN_RESTRICTED, "_POSIX_CHOWN_RESTRICTED", PATHCONF, NOFLAGS
632 },
633 #endif /* _PC_CHOWN_RESTRICTED */
634 #ifdef _PC_NO_TRUNC
635 {
636 _PC_NO_TRUNC, "_POSIX_NO_TRUNC", PATHCONF, NOFLAGS
637 },
638 #endif /* _PC_NO_TRUNC */
639 #ifdef _PC_VDISABLE
640 {
641 _PC_VDISABLE, "_POSIX_VDISABLE", PATHCONF, NOFLAGS
642 },
643 #endif /* _PC_VDISABLE */
644
645 /* UNIX 98 additions */
646
647 #ifdef _PC_ASYNC_IO
648 {
649 _PC_ASYNC_IO, "_POSIX_ASYNC_IO", PATHCONF, NOFLAGS
650 },
651 #endif /* _PC_ASYNC_IO */
652 #ifdef _PC_PRIO_IO
653 {
654 _PC_PRIO_IO, "_POSIX_PRIO_IO", PATHCONF, NOFLAGS
655 },
656 #endif /* _PC_PRIO_IO */
657 #ifdef _PC_SYNC_IO
658 {
659 _PC_SYNC_IO, "_POSIX_SYNC_IO", PATHCONF, NOFLAGS
660 },
661 #endif /* _PC_SYNC_IO */
662
663 /* Large File Summit name (UNIX 98) */
664
665 #ifdef _PC_FILESIZEBITS
666 {
667 _PC_FILESIZEBITS, "FILESIZEBITS", PATHCONF, NOFLAGS
668 },
669 #endif /* _PC_FILESIZEBITS */
670
671 /* UNIX 03 Additions */
672
673 /* Not supporting the Advisory Information (ADV) at this time. */
674 #ifdef _PC_ALLOC_SIZE_MIN
675 {
676 _PC_ALLOC_SIZE_MIN, "POSIX_ALLOC_SIZE_MIN", PATHCONF, NOFLAGS
677 },
678 #endif /* _PC_ALLOC_SIZE_MIN */
679 #ifdef _PC_REC_INCR_XFER_SIZE
680 {
681 _PC_REC_INCR_XFER_SIZE, "POSIX_REC_INCR_XFER_SIZE", PATHCONF, NOFLAGS
682 },
683 #endif /* _PC_REC_INCR_XFER_SIZE */
684 #ifdef _PC_REC_MAX_XFER_SIZE
685 {
686 _PC_REC_MAX_XFER_SIZE, "POSIX_REC_MAX_XFER_SIZE", PATHCONF, NOFLAGS
687 },
688 #endif /* _PC_REC_MAX_XFER_SIZE */
689 #ifdef _PC_REC_MIN_XFER_SIZE
690 {
691 _PC_REC_MIN_XFER_SIZE, "POSIX_REC_MIN_XFER_SIZE", PATHCONF, NOFLAGS
692 },
693 #endif /* _PC_REC_MIN_XFER_SIZE */
694 #ifdef _PC_REC_XFER_ALIGN
695 {
696 _PC_REC_XFER_ALIGN, "POSIX_REC_XFER_ALIGN", PATHCONF, NOFLAGS
697 },
698 #endif /* _PC_REC_XFER_ALIGN */
699
700 #ifdef _PC_2_SYMLINKS
701 {
702 _PC_2_SYMLINKS, "POSIX2_SYMLINKS", PATHCONF, NOFLAGS
703 },
704 #endif /* _PC_2_SYMLINKS */
705 #ifdef _PC_SYMLINK_MAX
706 {
707 _PC_SYMLINK_MAX, "SYMLINK_MAX", PATHCONF, NOFLAGS
708 },
709 #endif /* _PC_SYMLINK_MAX */
710
711 /* confstr() variables */
712
713 /* POSIX.2-1992 description of getconf utility */
714 {
715 0, "PATH", PATHVAR, NOFLAGS
716 },
717
718 /* POSIX.2-1992 table B-18 */
719 {
720 0, "CS_PATH", PATHVAR, NOFLAGS
721 },
722 {
723 0, "_CS_PATH", PATHVAR, NOFLAGS
724 },
725
726 /* command names for large file configuration information */
727 /* large file compilation environment configuration */
728
729 #ifdef _CS_LFS_CFLAGS
730 {
731 _CS_LFS_CFLAGS, "LFS_CFLAGS", CONFSTR, NOFLAGS
732 },
733 #endif /* _CS_LFS_CFLAGS */
734 #ifdef _CS_LFS_LDFLAGS
735 {
736 _CS_LFS_LDFLAGS, "LFS_LDFLAGS", CONFSTR, NOFLAGS
737 },
738 #endif /* _CS_LFS_LDFLAGS */
739 #ifdef _CS_LFS_LIBS
740 {
741 _CS_LFS_LIBS, "LFS_LIBS", CONFSTR, NOFLAGS
742 },
743 #endif /* _CS_LFS_LIBS */
744 #ifdef _CS_LFS_LINTFLAGS
745 {
746 _CS_LFS_LINTFLAGS, "LFS_LINTFLAGS", CONFSTR, NOFLAGS
747 },
748 #endif /* _CS_LFS_LINTFLAGS */
749
750 /* transitional large file interface configuration */
751
752 #ifdef _CS_LFS64_CFLAGS
753 {
754 _CS_LFS64_CFLAGS, "LFS64_CFLAGS", CONFSTR, NOFLAGS
755 },
756 #endif /* _CS_LFS64_CFLAGS */
757 #ifdef _CS_LFS64_LDFLAGS
758 {
759 _CS_LFS64_LDFLAGS, "LFS64_LDFLAGS", CONFSTR, NOFLAGS
760 },
761 #endif /* _CS_LFS64_LDFLAGS */
762 #ifdef _CS_LFS64_LIBS
763 {
764 _CS_LFS64_LIBS, "LFS64_LIBS", CONFSTR, NOFLAGS
765 },
766 #endif /* _CS_LFS64_LIBS */
767 #ifdef _CS_LFS64_LINTFLAGS
768 {
769 _CS_LFS64_LINTFLAGS, "LFS64_LINTFLAGS", CONFSTR, NOFLAGS
770 },
771 #endif /* _CS_LFS64_LINTFLAGS */
772
773 /*
774 * UNIX 98:
775 * confstr additions, these support
776 * programming specifications/environments.
777 *
778 * Unfortunately there is some uncertainty with
779 * the standard at this point about the constant
780 * name, thus we need to recognize BOTH with and
781 * without the initial underscore.
782 */
783 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
784 {
785 _CS_XBS5_ILP32_OFF32_CFLAGS, "XBS5_ILP32_OFF32_CFLAGS",
786 CONFSTR, NOFLAGS
787 },
788 #endif /* _CS_XBS5_ILP32_OFF32_CFLAGS */
789 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
790 {
791 _CS_XBS5_ILP32_OFF32_CFLAGS, "_XBS5_ILP32_OFF32_CFLAGS",
792 CONFSTR, NOFLAGS
793 },
794 #endif /* _CS_XBS5_ILP32_OFF32_CFLAGS */
795
796 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
797 {
798 _CS_XBS5_ILP32_OFF32_LDFLAGS, "XBS5_ILP32_OFF32_LDFLAGS",
799 CONFSTR, NOFLAGS
800 },
801 #endif /* _CS_XBS5_ILP32_OFF32_LDFLAGS */
802 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
803 {
804 _CS_XBS5_ILP32_OFF32_LDFLAGS, "_XBS5_ILP32_OFF32_LDFLAGS",
805 CONFSTR, NOFLAGS
806 },
807 #endif /* _CS_XBS5_ILP32_OFF32_LDFLAGS */
808
809 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
810 {
811 _CS_XBS5_ILP32_OFF32_LIBS, "XBS5_ILP32_OFF32_LIBS",
812 CONFSTR, NOFLAGS
813 },
814 #endif /* _CS_XBS5_ILP32_OFF32_LIBS */
815 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
816 {
817 _CS_XBS5_ILP32_OFF32_LIBS, "_XBS5_ILP32_OFF32_LIBS",
818 CONFSTR, NOFLAGS
819 },
820 #endif /* _CS_XBS5_ILP32_OFF32_LIBS */
821
822 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
823 {
824 _CS_XBS5_ILP32_OFF32_LINTFLAGS, "XBS5_ILP32_OFF32_LINTFLAGS",
825 CONFSTR, NOFLAGS
826 },
827 #endif /* _CS_XBS5_ILP32_OFF32_LINTFLAGS */
828 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
829 {
830 _CS_XBS5_ILP32_OFF32_LINTFLAGS, "_XBS5_ILP32_OFF32_LINTFLAGS",
831 CONFSTR, NOFLAGS
832 },
833 #endif /* _CS_XBS5_ILP32_OFF32_LINTFLAGS */
834
835 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
836 {
837 _CS_XBS5_ILP32_OFFBIG_CFLAGS, "XBS5_ILP32_OFFBIG_CFLAGS",
838 CONFSTR, NOFLAGS
839 },
840 #endif /* _CS_XBS5_ILP32_OFFBIG_CFLAGS */
841 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
842 {
843 _CS_XBS5_ILP32_OFFBIG_CFLAGS, "_XBS5_ILP32_OFFBIG_CFLAGS",
844 CONFSTR, NOFLAGS
845 },
846 #endif /* _CS_XBS5_ILP32_OFFBIG_CFLAGS */
847
848 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
849 {
850 _CS_XBS5_ILP32_OFFBIG_LDFLAGS, "XBS5_ILP32_OFFBIG_LDFLAGS",
851 CONFSTR, NOFLAGS
852 },
853 #endif /* _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
854 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
855 {
856 _CS_XBS5_ILP32_OFFBIG_LDFLAGS, "_XBS5_ILP32_OFFBIG_LDFLAGS",
857 CONFSTR, NOFLAGS
858 },
859 #endif /* _CS_XBS5_ILP32_OFFBIG_LDFLAGS */
860
861 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
862 {
863 _CS_XBS5_ILP32_OFFBIG_LIBS, "XBS5_ILP32_OFFBIG_LIBS",
864 CONFSTR, NOFLAGS
865 },
866 #endif /* _CS_XBS5_ILP32_OFFBIG_LIBS */
867 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
868 {
869 _CS_XBS5_ILP32_OFFBIG_LIBS, "_XBS5_ILP32_OFFBIG_LIBS",
870 CONFSTR, NOFLAGS
871 },
872 #endif /* _CS_XBS5_ILP32_OFFBIG_LIBS */
873
874 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
875 {
876 _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, "XBS5_ILP32_OFFBIG_LINTFLAGS",
877 CONFSTR, NOFLAGS
878 },
879 #endif /* _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
880 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
881 {
882 _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, "_XBS5_ILP32_OFFBIG_LINTFLAGS",
883 CONFSTR, NOFLAGS
884 },
885 #endif /* _CS_XBS5_ILP32_OFFBIG_LINTFLAGS */
886
887 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
888 {
889 _CS_XBS5_LP64_OFF64_CFLAGS, "XBS5_LP64_OFF64_CFLAGS",
890 CONFSTR, NOFLAGS
891 },
892 #endif /* _CS_XBS5_LP64_OFF64_CFLAGS */
893 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
894 {
895 _CS_XBS5_LP64_OFF64_CFLAGS, "_XBS5_LP64_OFF64_CFLAGS",
896 CONFSTR, NOFLAGS
897 },
898 #endif /* _CS_XBS5_LP64_OFF64_CFLAGS */
899
900 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
901 {
902 _CS_XBS5_LP64_OFF64_LDFLAGS, "XBS5_LP64_OFF64_LDFLAGS",
903 CONFSTR, NOFLAGS
904 },
905 #endif /* _CS_XBS5_LP64_OFF64_LDFLAGS */
906 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
907 {
908 _CS_XBS5_LP64_OFF64_LDFLAGS, "_XBS5_LP64_OFF64_LDFLAGS",
909 CONFSTR, NOFLAGS
910 },
911 #endif /* _CS_XBS5_LP64_OFF64_LDFLAGS */
912
913 #ifdef _CS_XBS5_LP64_OFF64_LIBS
914 {
915 _CS_XBS5_LP64_OFF64_LIBS, "XBS5_LP64_OFF64_LIBS",
916 CONFSTR, NOFLAGS
917 },
918 #endif /* _CS_XBS5_LP64_OFF64_LIBS */
919 #ifdef _CS_XBS5_LP64_OFF64_LIBS
920 {
921 _CS_XBS5_LP64_OFF64_LIBS, "_XBS5_LP64_OFF64_LIBS",
922 CONFSTR, NOFLAGS
923 },
924 #endif /* _CS_XBS5_LP64_OFF64_LIBS */
925
926 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
927 {
928 _CS_XBS5_LP64_OFF64_LINTFLAGS, "XBS5_LP64_OFF64_LINTFLAGS",
929 CONFSTR, NOFLAGS
930 },
931 #endif /* _CS_XBS5_LP64_OFF64_LINTFLAGS */
932 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
933 {
934 _CS_XBS5_LP64_OFF64_LINTFLAGS, "_XBS5_LP64_OFF64_LINTFLAGS",
935 CONFSTR, NOFLAGS
936 },
937 #endif /* _CS_XBS5_LP64_OFF64_LINTFLAGS */
938
939 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
940 {
941 _CS_XBS5_LPBIG_OFFBIG_CFLAGS, "XBS5_LPBIG_OFFBIG_CFLAGS",
942 CONFSTR, NOFLAGS
943 },
944 #endif /* _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
945 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
946 {
947 _CS_XBS5_LPBIG_OFFBIG_CFLAGS, "_XBS5_LPBIG_OFFBIG_CFLAGS",
948 CONFSTR, NOFLAGS
949 },
950 #endif /* _CS_XBS5_LPBIG_OFFBIG_CFLAGS */
951
952 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
953 {
954 _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, "XBS5_LPBIG_OFFBIG_LDFLAGS",
955 CONFSTR, NOFLAGS
956 },
957 #endif /* _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
958 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
959 {
960 _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, "_XBS5_LPBIG_OFFBIG_LDFLAGS",
961 CONFSTR, NOFLAGS
962 },
963 #endif /* _CS_XBS5_LPBIG_OFFBIG_LDFLAGS */
964
965 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
966 {
967 _CS_XBS5_LPBIG_OFFBIG_LIBS, "XBS5_LPBIG_OFFBIG_LIBS",
968 CONFSTR, NOFLAGS
969 },
970 #endif /* _CS_XBS5_LPBIG_OFFBIG_LIBS */
971 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
972 {
973 _CS_XBS5_LPBIG_OFFBIG_LIBS, "_XBS5_LPBIG_OFFBIG_LIBS",
974 CONFSTR, NOFLAGS
975 },
976 #endif /* _CS_XBS5_LPBIG_OFFBIG_LIBS */
977
978 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
979 {
980 _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, "XBS5_LPBIG_OFFBIG_LINTFLAGS",
981 CONFSTR, NOFLAGS
982 },
983 #endif /* _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
984 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
985 {
986 _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, "_XBS5_LPBIG_OFFBIG_LINTFLAGS",
987 CONFSTR, NOFLAGS
988 },
989 #endif /* _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS */
990
991 /*
992 * UNIX 03 confstr() additions for compilation environments
993 */
994 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
995 {
996 _CS_POSIX_V6_ILP32_OFF32_CFLAGS, "POSIX_V6_ILP32_OFF32_CFLAGS",
997 CONFSTR, NOFLAGS
998 },
999 #endif /* _CS_POSIX_V6_ILP32_OFF32_CFLAGS */
1000 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
1001 {
1002 _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, "POSIX_V6_ILP32_OFF32_LDFLAGS",
1003 CONFSTR, NOFLAGS
1004 },
1005 #endif /* _CS_POSIX_V6_ILP32_OFF32_LDFLAGS */
1006 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
1007 {
1008 _CS_POSIX_V6_ILP32_OFF32_LIBS, "POSIX_V6_ILP32_OFF32_LIBS",
1009 CONFSTR, NOFLAGS
1010 },
1011 #endif /* _CS_POSIX_V6_ILP32_OFF32_LIBS */
1012 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
1013 {
1014 _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, "POSIX_V6_ILP32_OFFBIG_CFLAGS",
1015 CONFSTR, NOFLAGS
1016 },
1017 #endif /* _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS */
1018 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
1019 {
1020 _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, "POSIX_V6_ILP32_OFFBIG_LDFLAGS",
1021 CONFSTR, NOFLAGS
1022 },
1023 #endif /* _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS */
1024 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
1025 {
1026 _CS_POSIX_V6_ILP32_OFFBIG_LIBS, "POSIX_V6_ILP32_OFFBIG_LIBS",
1027 CONFSTR, NOFLAGS
1028 },
1029 #endif /* _CS_POSIX_V6_ILP32_OFFBIG_LIBS */
1030 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
1031 {
1032 _CS_POSIX_V6_LP64_OFF64_CFLAGS, "POSIX_V6_LP64_OFF64_CFLAGS",
1033 CONFSTR, NOFLAGS
1034 },
1035 #endif /* _CS_POSIX_V6_LP64_OFF64_CFLAGS */
1036 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
1037 {
1038 _CS_POSIX_V6_LP64_OFF64_LDFLAGS, "POSIX_V6_LP64_OFF64_LDFLAGS",
1039 CONFSTR, NOFLAGS
1040 },
1041 #endif /* _CS_POSIX_V6_LP64_OFF64_LDFLAGS */
1042 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
1043 {
1044 _CS_POSIX_V6_LP64_OFF64_LIBS, "POSIX_V6_LP64_OFF64_LIBS",
1045 CONFSTR, NOFLAGS
1046 },
1047 #endif /* _CS_POSIX_V6_LP64_OFF64_LIBS */
1048 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
1049 {
1050 _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, "POSIX_V6_LPBIG_OFFBIG_CFLAGS",
1051 CONFSTR, NOFLAGS
1052 },
1053 #endif /* _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS */
1054 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
1055 {
1056 _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, "POSIX_V6_LPBIG_OFFBIG_LDFLAGS",
1057 CONFSTR, NOFLAGS
1058 },
1059 #endif /* _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS */
1060 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
1061 {
1062 _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, "POSIX_V6_LPBIG_OFFBIG_LIBS",
1063 CONFSTR, NOFLAGS
1064 },
1065 #endif /* _CS_POSIX_V6_LPBIG_OFFBIG_LIBS */
1066 #ifdef _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
1067 {
1068 _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS, "POSIX_V6_WIDTH_RESTRICTED_ENVS",
1069 CONFSTR, NOFLAGS
1070 },
1071 #endif /* _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS */
1072 /* End of UNIX 03 compilation environments */
1073
1074 #if defined _SC_2_C_VERSION
1075 /* POSIX.2 table B-4 */
1076 {
1077 _SC_2_C_VERSION, "_POSIX2_C_VERSION", SYSCONF, NOFLAGS
1078 },
1079 #elif defined _POSIX2_C_VERSION
1080 {
1081 _POSIX2_C_VERSION, "_POSIX2_C_VERSION", SELFCONF, NOFLAGS
1082 },
1083 #endif /* _SC_2_C_VERSION, _POSIX2_C_VERSION */
1084
1085 /*
1086 * XPG4 support BEGINS
1087 */
1088
1089 #ifndef CHARCLASS_NAME_MAX
1090 #define CHARCLASS_NAME_MAX -1
1091 #endif
1092 #ifndef CHAR_BIT
1093 #define CHAR_BIT -1
1094 #endif
1095 #ifndef CHAR_MAX
1096 #define CHAR_MAX -1
1097 #endif
1098 #ifndef CHAR_MIN
1099 #define CHAR_MIN -1
1100 #endif
1101 #ifndef INT_MAX
1102 #define INT_MAX -1
1103 #endif
1104 #ifndef INT_MIN
1105 #define INT_MIN -1
1106 #endif
1107 #ifndef LONG_BIT
1108 #define LONG_BIT -1
1109 #endif
1110 #ifndef LONG_MAX
1111 #define LONG_MAX -1
1112 #endif
1113 #ifndef LONG_MIN
1114 #define LONG_MIN -1
1115 #endif
1116 #ifndef MB_LEN_MAX
1117 #define MB_LEN_MAX -1
1118 #endif
1119 #ifndef NL_NMAX
1120 #define NL_NMAX -1
1121 #endif
1122 #ifndef NL_ARGMAX
1123 #define NL_ARGMAX -1
1124 #endif
1125 #ifndef NL_LANGMAX
1126 #define NL_LANGMAX -1
1127 #endif
1128 #ifndef NL_MSGMAX
1129 #define NL_MSGMAX -1
1130 #endif
1131 #ifndef NL_SETMAX
1132 #define NL_SETMAX -1
1133 #endif
1134 #ifndef NL_TEXTMAX
1135 #define NL_TEXTMAX -1
1136 #endif
1137 #ifndef NZERO
1138 #define NZERO -1
1139 #endif
1140 #ifndef SCHAR_MAX
1141 #define SCHAR_MAX -1
1142 #endif
1143 #ifndef SCHAR_MIN
1144 #define SCHAR_MIN -1
1145 #endif
1146 #ifndef SHRT_MAX
1147 #define SHRT_MAX -1
1148 #endif
1149 #ifndef SHRT_MIN
1150 #define SHRT_MIN -1
1151 #endif
1152 #ifndef TMP_MAX
1153 #define TMP_MAX -1
1154 #endif
1155 #ifndef WORD_BIT
1156 #define WORD_BIT -1
1157 #endif
1158
1159
1160 #ifndef _XOPEN_XPG2
1161 #define _XOPEN_XPG2 -1
1162 #endif
1163 #ifndef _XOPEN_XPG3
1164 #define _XOPEN_XPG3 -1
1165 #endif
1166 #ifndef _XOPEN_XPG4
1167 #define _XOPEN_XPG4 -1
1168 #endif
1169
1170 /*
1171 * the following are values that we should find in <limits.h>
1172 * so we use SELFCONF here.
1173 *
1174 */
1175
1176 /* POSIX.1-1990 */
1177 #ifdef CHARCLASS_NAME_MAX
1178 {
1179 CHARCLASS_NAME_MAX, "CHARCLASS_NAME_MAX", SELFCONF, NOFLAGS
1180 },
1181 #endif /* CHARCLASS_NAME_MAX */
1182 {
1183 _POSIX_SSIZE_MAX, "SSIZE_MAX", SELFCONF, NOFLAGS
1184 },
1185
1186 /* POSIX.1-1988 */
1187 #ifdef CHAR_BIT
1188 {
1189 CHAR_BIT, "CHAR_BIT", SELFCONF, NOFLAGS
1190 },
1191 #endif /* CHAR_BIT */
1192 #ifdef CHAR_MAX
1193 {
1194 CHAR_MAX, "CHAR_MAX", SELFCONF, NOFLAGS
1195 },
1196 #endif /* CHAR_MAX */
1197 #ifdef CHAR_MIN
1198 {
1199 CHAR_MIN, "CHAR_MIN", SELFCONF, NOFLAGS
1200 },
1201 #endif /* CHAR_MIN */
1202 #ifdef INT_MAX
1203 {
1204 INT_MAX, "INT_MAX", SELFCONF, NOFLAGS
1205 },
1206 #endif /* INT_MAX */
1207 #ifdef INT_MIN
1208 {
1209 INT_MIN, "INT_MIN", SELFCONF, NOFLAGS
1210 },
1211 #endif /* INT_MIN */
1212 #ifdef LONG_BIT
1213 {
1214 LONG_BIT, "LONG_BIT", SELFCONF, NOFLAGS
1215 },
1216 #endif /* LONG_BIT */
1217 #ifdef LONG_MAX
1218 {
1219 LONG_MAX, "LONG_MAX", SELFCONF, NOFLAGS
1220 },
1221 #endif /* LONG_MAX */
1222 #ifdef LONG_MIN
1223 {
1224 LONG_MIN, "LONG_MIN", SELFCONF, NOFLAGS
1225 },
1226 #endif /* LONG_MIN */
1227 #ifdef MB_LEN_MAX
1228 {
1229 MB_LEN_MAX, "MB_LEN_MAX", SELFCONF, NOFLAGS
1230 },
1231 #endif /* MB_LEN_MAX */
1232 #ifdef NL_NMAX
1233 {
1234 NL_NMAX, "NL_NMAX", SELFCONF, NOFLAGS
1235 },
1236 #endif /* NL_NMAX */
1237 #ifdef NL_ARGMAX
1238 {
1239 NL_ARGMAX, "NL_ARGMAX", SELFCONF, NOFLAGS
1240 },
1241 #endif /* NL_ARGMAX */
1242 #ifdef NL_LANGMAX
1243 {
1244 NL_LANGMAX, "NL_LANGMAX", SELFCONF, NOFLAGS
1245 },
1246 #endif /* NL_LANGMAX */
1247 #ifdef NL_MSGMAX
1248 {
1249 NL_MSGMAX, "NL_MSGMAX", SELFCONF, NOFLAGS
1250 },
1251 #endif /* NL_MSGMAX */
1252 #ifdef NL_SETMAX
1253 {
1254 NL_SETMAX, "NL_SETMAX", SELFCONF, NOFLAGS
1255 },
1256 #endif /* NL_SETMAX */
1257 #ifdef NL_TEXTMAX
1258 {
1259 NL_TEXTMAX, "NL_TEXTMAX", SELFCONF, NOFLAGS
1260 },
1261 #endif /* NL_TEXTMAX */
1262 #ifdef NZERO
1263 {
1264 NZERO, "NZERO", SELFCONF, NOFLAGS
1265 },
1266 #endif /* NZERO */
1267 #ifdef SCHAR_MAX
1268 {
1269 SCHAR_MAX, "SCHAR_MAX", SELFCONF, NOFLAGS
1270 },
1271 #endif /* SCHAR_MAX */
1272 #ifdef SCHAR_MIN
1273 {
1274 SCHAR_MIN, "SCHAR_MIN", SELFCONF, NOFLAGS
1275 },
1276 #endif /* SCHAR_MIN */
1277 #ifdef SHRT_MAX
1278 {
1279 SHRT_MAX, "SHRT_MAX", SELFCONF, NOFLAGS
1280 },
1281 #endif /* SHRT_MAX */
1282 #ifdef SHRT_MIN
1283 {
1284 SHRT_MIN, "SHRT_MIN", SELFCONF, NOFLAGS
1285 },
1286 #endif /* SHRT_MIN */
1287 #ifdef TMP_MAX
1288 {
1289 TMP_MAX, "TMP_MAX", SELFCONF, NOFLAGS
1290 },
1291 #endif /* TMP_MAX */
1292
1293 /*
1294 * for the unsigned maximums, we cannot rely on the value -1
1295 * to indicate "undefined".
1296 */
1297 #ifndef UCHAR_MAX
1298 #ifdef 0
1299 {
1300 0, "UCHAR_MAX", SELFCONF, UNDEFINED
1301 },
1302 #endif /* 0 */
1303 #else
1304 #ifdef UCHAR_MAX
1305 {
1306 (long)UCHAR_MAX, "UCHAR_MAX", SELFCONF, UNSIGNED_VALUE
1307 },
1308 #endif /* UCHAR_MAX */
1309 #endif /* UCHAR_MAX */
1310 #ifndef UINT_MAX
1311 #ifdef 0
1312 {
1313 0, "UINT_MAX", SELFCONF, UNDEFINED
1314 },
1315 #endif /* 0 */
1316 #else
1317 #ifdef UINT_MAX
1318 {
1319 (long)UINT_MAX, "UINT_MAX", SELFCONF, UNSIGNED_VALUE
1320 },
1321 #endif /* UINT_MAX */
1322 #endif /* UINT_MAX */
1323 #ifndef ULONG_MAX
1324 #ifdef 0
1325 {
1326 0, "ULONG_MAX", SELFCONF, UNDEFINED
1327 },
1328 #endif /* 0 */
1329 #else
1330 #ifdef ULONG_MAX
1331 {
1332 (long)ULONG_MAX, "ULONG_MAX", SELFCONF, UNSIGNED_VALUE
1333 },
1334 #endif /* ULONG_MAX */
1335 #endif /* ULONG_MAX */
1336 #ifndef USHRT_MAX
1337 #ifdef 0
1338 {
1339 0, "USHRT_MAX", SELFCONF, UNDEFINED
1340 },
1341 #endif /* 0 */
1342 #else
1343 #ifdef USHRT_MAX
1344 {
1345 (long)USHRT_MAX, "USHRT_MAX", SELFCONF, UNSIGNED_VALUE
1346 },
1347 #endif /* USHRT_MAX */
1348 #endif /* USHRT_MAX */
1349 #ifndef SIZE_MAX
1350 {
1351 0, "SIZE_MAX", SELFCONF, UNDEFINED
1352 },
1353 #else
1354 #ifdef SIZE_MAX
1355 {
1356 (long)SIZE_MAX, "SIZE_MAX", SELFCONF, UNSIGNED_VALUE
1357 },
1358 #endif /* SIZE_MAX */
1359 #endif /* SIZE_MAX */
1360
1361 #ifdef WORD_BIT
1362 {
1363 WORD_BIT, "WORD_BIT", SELFCONF, NOFLAGS
1364 },
1365 #endif /* WORD_BIT */
1366
1367 /* XPG4 Version 2 */
1368 {
1369 _XOPEN_IOV_MAX, "_XOPEN_IOV_MAX", SELFCONF, NOFLAGS
1370 },
1371
1372 /* UNIX 03 */
1373 {
1374 _XOPEN_NAME_MAX, "_XOPEN_NAME_MAX", SELFCONF, NOFLAGS
1375 },
1376 {
1377 _XOPEN_PATH_MAX, "_XOPEN_PATH_MAX", SELFCONF, NOFLAGS
1378 },
1379
1380 /*
1381 * The following are defined via sysconf(). These are considered
1382 * an extension to sysconf().
1383 * The -0 is needed if _XOPEN_XPG? is defined to be an empty string.
1384 */
1385 #ifdef _XOPEN_XPG2
1386 {
1387 _XOPEN_XPG2-0, "_XOPEN_XPG2", SELFCONF, NOFLAGS
1388 },
1389 #endif /* _XOPEN_XPG2 */
1390 #ifdef _XOPEN_XPG3
1391 {
1392 _XOPEN_XPG3-0, "_XOPEN_XPG3", SELFCONF, NOFLAGS
1393 },
1394 #endif /* _XOPEN_XPG3 */
1395 #ifdef _XOPEN_XPG4
1396 {
1397 _XOPEN_XPG4-0, "_XOPEN_XPG4", SELFCONF, NOFLAGS
1398 },
1399 #endif /* _XOPEN_XPG4 */
1400
1401 /*
1402 * The following should be provided by sysconf() (e.g use SYSCONF),
1403 * so we look for the appropriate _SC_* symbol in <unistd.h>.
1404 * If it is not defined, then we use SELFCONF with the value of -1.
1405 */
1406 #ifdef _SC_XOPEN_VERSION
1407 {
1408 _SC_XOPEN_VERSION, "_XOPEN_VERSION", SYSCONF, NOFLAGS
1409 },
1410 #endif /* _SC_XOPEN_VERSION */
1411 {
1412 _XOPEN_XCU_VERSION, "_XOPEN_XCU_VERSION", SELFCONF, NOFLAGS
1413 },
1414 #ifdef _SC_XOPEN_CRYPT
1415 {
1416 _SC_XOPEN_CRYPT, "_XOPEN_CRYPT", SYSCONF, NOFLAGS
1417 },
1418 #endif /* _SC_XOPEN_CRYPT */
1419 #ifdef _SC_XOPEN_ENH_I18N
1420 {
1421 _SC_XOPEN_ENH_I18N, "_XOPEN_ENH_I18N", SYSCONF, NOFLAGS
1422 },
1423 #endif /* _SC_XOPEN_ENH_I18N */
1424 #ifdef _SC_XOPEN_SHM
1425 {
1426 _SC_XOPEN_SHM, "_XOPEN_SHM", SYSCONF, NOFLAGS
1427 },
1428 #endif /* _SC_XOPEN_SHM */
1429
1430 /*
1431 * XPG4 support ends
1432 */
1433
1434 /* XPG4, Version 2 support */
1435
1436 #ifdef _SC_ATEXIT_MAX
1437 {
1438 _SC_ATEXIT_MAX, "ATEXIT_MAX", SYSCONF, NOFLAGS
1439 },
1440 #endif /* _SC_ATEXIT_MAX */
1441 #ifdef _SC_PAGESIZE
1442 {
1443 _SC_PAGESIZE, "PAGESIZE", SYSCONF, NOFLAGS
1444 },
1445 #endif /* _SC_PAGESIZE */
1446 #ifdef _SC_PAGE_SIZE
1447 {
1448 _SC_PAGE_SIZE, "PAGE_SIZE", SYSCONF, NOFLAGS
1449 },
1450 #endif /* _SC_PAGE_SIZE */
1451 #ifdef _SC_XOPEN_UNIX
1452 {
1453 _SC_XOPEN_UNIX, "_XOPEN_UNIX", SYSCONF, NOFLAGS
1454 },
1455 #endif /* _SC_XOPEN_UNIX */
1456 #ifdef _SC_IOV_MAX
1457 {
1458 _SC_IOV_MAX, "IOV_MAX", SYSCONF, NOFLAGS
1459 },
1460 #endif /* _SC_IOV_MAX */
1461
1462 /*
1463 * UNIX 98 - XPG5 additions
1464 */
1465 #ifdef _SC_XOPEN_LEGACY
1466 {
1467 _SC_XOPEN_LEGACY, "_XOPEN_LEGACY", SYSCONF, NOFLAGS
1468 },
1469 #endif /* _SC_XOPEN_LEGACY */
1470 #ifdef _SC_PASS_MAX
1471 {
1472 _SC_PASS_MAX, "PASS_MAX", SYSCONF, NOFLAGS
1473 },
1474 #endif /* _SC_PASS_MAX */
1475 #ifdef _SC_AIO_LISTIO_MAX
1476 {
1477 _SC_AIO_LISTIO_MAX, "AIO_LISTIO_MAX", SYSCONF, NOFLAGS
1478 },
1479 #endif /* _SC_AIO_LISTIO_MAX */
1480 #ifdef _SC_AIO_MAX
1481 {
1482 _SC_AIO_MAX, "AIO_MAX", SYSCONF, NOFLAGS
1483 },
1484 #endif /* _SC_AIO_MAX */
1485 #ifdef _SC_AIO_PRIO_DELTA_MAX
1486 {
1487 _SC_AIO_PRIO_DELTA_MAX, "AIO_PRIO_DELTA_MAX", SYSCONF, NOFLAGS
1488 },
1489 #endif /* _SC_AIO_PRIO_DELTA_MAX */
1490 #ifdef _SC_DELAYTIMER_MAX
1491 {
1492 _SC_DELAYTIMER_MAX, "DELAYTIMER_MAX", SYSCONF, NOFLAGS
1493 },
1494 #endif /* _SC_DELAYTIMER_MAX */
1495 #ifdef _SC_MQ_OPEN_MAX
1496 {
1497 _SC_MQ_OPEN_MAX, "MQ_OPEN_MAX", SYSCONF, NOFLAGS
1498 },
1499 #endif /* _SC_MQ_OPEN_MAX */
1500 #ifdef _SC_MQ_PRIO_MAX
1501 {
1502 _SC_MQ_PRIO_MAX, "MQ_PRIO_MAX", SYSCONF, NOFLAGS
1503 },
1504 #endif /* _SC_MQ_PRIO_MAX */
1505 #ifdef _SC_RTSIG_MAX
1506 {
1507 _SC_RTSIG_MAX, "RTSIG_MAX", SYSCONF, NOFLAGS
1508 },
1509 #endif /* _SC_RTSIG_MAX */
1510 #ifdef _SC_SEM_NSEMS_MAX
1511 {
1512 _SC_SEM_NSEMS_MAX, "SEM_NSEMS_MAX", SYSCONF, NOFLAGS
1513 },
1514 #endif /* _SC_SEM_NSEMS_MAX */
1515 #ifdef _SC_SEM_VALUE_MAX
1516 {
1517 _SC_SEM_VALUE_MAX, "SEM_VALUE_MAX", SYSCONF, NOFLAGS
1518 },
1519 #endif /* _SC_SEM_VALUE_MAX */
1520 #ifdef _SC_SIGQUEUE_MAX
1521 {
1522 _SC_SIGQUEUE_MAX, "SIGQUEUE_MAX", SYSCONF, NOFLAGS
1523 },
1524 #endif /* _SC_SIGQUEUE_MAX */
1525 #ifdef _SC_TIMER_MAX
1526 {
1527 _SC_TIMER_MAX, "TIMER_MAX", SYSCONF, NOFLAGS
1528 },
1529 #endif /* _SC_TIMER_MAX */
1530
1531 #ifdef _SC_ASYNCHRONOUS_IO
1532 {
1533 _SC_ASYNCHRONOUS_IO, "_POSIX_ASYNCHRONOUS_IO", SYSCONF, NOFLAGS
1534 },
1535 #endif /* _SC_ASYNCHRONOUS_IO */
1536 #ifdef _SC_FSYNC
1537 {
1538 _SC_FSYNC, "_POSIX_FSYNC", SYSCONF, NOFLAGS
1539 },
1540 #endif /* _SC_FSYNC */
1541 #ifdef _SC_MAPPED_FILES
1542 {
1543 _SC_MAPPED_FILES, "_POSIX_MAPPED_FILES", SYSCONF, NOFLAGS
1544 },
1545 #endif /* _SC_MAPPED_FILES */
1546 #ifdef _SC_MEMLOCK
1547 {
1548 _SC_MEMLOCK, "_POSIX_MEMLOCK", SYSCONF, NOFLAGS
1549 },
1550 #endif /* _SC_MEMLOCK */
1551 #ifdef _SC_MEMLOCK_RANGE
1552 {
1553 _SC_MEMLOCK_RANGE, "_POSIX_MEMLOCK_RANGE", SYSCONF, NOFLAGS
1554 },
1555 #endif /* _SC_MEMLOCK_RANGE */
1556 #ifdef _SC_MEMORY_PROTECTION
1557 {
1558 _SC_MEMORY_PROTECTION, "_POSIX_MEMORY_PROTECTION", SYSCONF, NOFLAGS
1559 },
1560 #endif /* _SC_MEMORY_PROTECTION */
1561 #ifdef _SC_MESSAGE_PASSING
1562 {
1563 _SC_MESSAGE_PASSING, "_POSIX_MESSAGE_PASSING", SYSCONF, NOFLAGS
1564 },
1565 #endif /* _SC_MESSAGE_PASSING */
1566 #ifdef _SC_PRIORITIZED_IO
1567 {
1568 _SC_PRIORITIZED_IO, "_POSIX_PRIORITIZED_IO", SYSCONF, NOFLAGS
1569 },
1570 #endif /* _SC_PRIORITIZED_IO */
1571 #ifdef _SC_PRIORITY_SCHEDULING
1572 {
1573 _SC_PRIORITY_SCHEDULING, "_POSIX_PRIORITY_SCHEDULING", SYSCONF, NOFLAGS
1574 },
1575 #endif /* _SC_PRIORITY_SCHEDULING */
1576 #ifdef _SC_REALTIME_SIGNALS
1577 {
1578 _SC_REALTIME_SIGNALS, "_POSIX_REALTIME_SIGNALS", SYSCONF, NOFLAGS
1579 },
1580 #endif /* _SC_REALTIME_SIGNALS */
1581 #ifdef _SC_SEMAPHORES
1582 {
1583 _SC_SEMAPHORES, "_POSIX_SEMAPHORES", SYSCONF, NOFLAGS
1584 },
1585 #endif /* _SC_SEMAPHORES */
1586
1587 #ifdef _SC_SHARED_MEMORY_OBJECTS
1588 {
1589 _SC_SHARED_MEMORY_OBJECTS, "_POSIX_SHARED_MEMORY_OBJECTS",
1590 SYSCONF, NOFLAGS
1591 },
1592 #endif /* _SC_SHARED_MEMORY_OBJECTS */
1593
1594 #ifdef _SC_SYNCHRONIZED_IO
1595 {
1596 _SC_SYNCHRONIZED_IO, "_POSIX_SYNCHRONIZED_IO", SYSCONF, NOFLAGS
1597 },
1598 #endif /* _SC_SYNCHRONIZED_IO */
1599 #ifdef _SC_TIMERS
1600 {
1601 _SC_TIMERS, "_POSIX_TIMERS", SYSCONF, NOFLAGS
1602 },
1603 #endif /* _SC_TIMERS */
1604
1605 #ifdef _SC_LOGIN_NAME_MAX
1606 {
1607 _SC_LOGIN_NAME_MAX, "LOGIN_NAME_MAX", SYSCONF, NOFLAGS
1608 },
1609 #endif /* _SC_LOGIN_NAME_MAX */
1610
1611 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
1612 {
1613 _SC_THREAD_DESTRUCTOR_ITERATIONS, "PTHREAD_DESTRUCTOR_ITERATIONS",
1614 SYSCONF, NOFLAGS
1615 },
1616 #endif /* _SC_THREAD_DESTRUCTOR_ITERATIONS */
1617
1618 #ifdef _SC_THREAD_KEYS_MAX
1619 {
1620 _SC_THREAD_KEYS_MAX, "PTHREAD_KEYS_MAX", SYSCONF, NOFLAGS
1621 },
1622 #endif /* _SC_THREAD_KEYS_MAX */
1623 #ifdef _SC_THREAD_STACK_MIN
1624 {
1625 _SC_THREAD_STACK_MIN, "PTHREAD_STACK_MIN", SYSCONF, NOFLAGS
1626 },
1627 #endif /* _SC_THREAD_STACK_MIN */
1628 #ifdef _SC_THREAD_THREADS_MAX
1629 {
1630 _SC_THREAD_THREADS_MAX, "PTHREAD_THREADS_MAX", SYSCONF, NOFLAGS
1631 },
1632 #endif /* _SC_THREAD_THREADS_MAX */
1633
1634 #ifdef _SC_THREADS
1635 {
1636 _SC_THREADS, "_POSIX_THREADS", SYSCONF, NOFLAGS
1637 },
1638 #endif /* _SC_THREADS */
1639
1640 #ifdef _SC_THREAD_ATTR_STACKADDR
1641 {
1642 _SC_THREAD_ATTR_STACKADDR, "POSIX_THREAD_ATTR_STACKADDR",
1643 SYSCONF, NOFLAGS
1644 },
1645 #endif /* _SC_THREAD_ATTR_STACKADDR */
1646 #ifdef _SC_THREAD_ATTR_STACKADDR
1647 {
1648 _SC_THREAD_ATTR_STACKADDR, "_POSIX_THREAD_ATTR_STACKADDR",
1649 SYSCONF, NOFLAGS
1650 },
1651 #endif /* _SC_THREAD_ATTR_STACKADDR */
1652
1653 #ifdef _SC_THREAD_ATTR_STACKSIZE
1654 {
1655 _SC_THREAD_ATTR_STACKSIZE, "POSIX_THREAD_ATTR_STACKSIZE",
1656 SYSCONF, NOFLAGS
1657 },
1658 #endif /* _SC_THREAD_ATTR_STACKSIZE */
1659 #ifdef _SC_THREAD_ATTR_STACKSIZE
1660 {
1661 _SC_THREAD_ATTR_STACKSIZE, "_POSIX_THREAD_ATTR_STACKSIZE",
1662 SYSCONF, NOFLAGS
1663 },
1664 #endif /* _SC_THREAD_ATTR_STACKSIZE */
1665
1666 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
1667 {
1668 _SC_THREAD_PRIORITY_SCHEDULING, "POSIX_THREAD_PRIORITY_SCHEDULING",
1669 SYSCONF, NOFLAGS
1670 },
1671 #endif /* _SC_THREAD_PRIORITY_SCHEDULING */
1672 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
1673 {
1674 _SC_THREAD_PRIORITY_SCHEDULING, "_POSIX_THREAD_PRIORITY_SCHEDULING",
1675 SYSCONF, NOFLAGS
1676 },
1677 #endif /* _SC_THREAD_PRIORITY_SCHEDULING */
1678
1679 #ifdef _SC_THREAD_PRIO_INHERIT
1680 {
1681 _SC_THREAD_PRIO_INHERIT, "POSIX_THREAD_PRIO_INHERIT",
1682 SYSCONF, NOFLAGS
1683 },
1684 #endif /* _SC_THREAD_PRIO_INHERIT */
1685 #ifdef _SC_THREAD_PRIO_INHERIT
1686 {
1687 _SC_THREAD_PRIO_INHERIT, "_POSIX_THREAD_PRIO_INHERIT",
1688 SYSCONF, NOFLAGS
1689 },
1690 #endif /* _SC_THREAD_PRIO_INHERIT */
1691
1692 #ifdef _SC_THREAD_PRIO_PROTECT
1693 {
1694 _SC_THREAD_PRIO_PROTECT, "POSIX_THREAD_PRIO_PROTECT",
1695 SYSCONF, NOFLAGS
1696 },
1697 #endif /* _SC_THREAD_PRIO_PROTECT */
1698 #ifdef _SC_THREAD_PRIO_PROTECT
1699 {
1700 _SC_THREAD_PRIO_PROTECT, "_POSIX_THREAD_PRIO_PROTECT",
1701 SYSCONF, NOFLAGS
1702 },
1703 #endif /* _SC_THREAD_PRIO_PROTECT */
1704
1705 #ifdef _SC_THREAD_PROCESS_SHARED
1706 {
1707 _SC_THREAD_PROCESS_SHARED, "POSIX_THREAD_PROCESS_SHARED",
1708 SYSCONF, NOFLAGS
1709 },
1710 #endif /* _SC_THREAD_PROCESS_SHARED */
1711 #ifdef _SC_THREAD_PROCESS_SHARED
1712 {
1713 _SC_THREAD_PROCESS_SHARED, "_POSIX_THREAD_PROCESS_SHARED",
1714 SYSCONF, NOFLAGS
1715 },
1716 #endif /* _SC_THREAD_PROCESS_SHARED */
1717
1718 #ifdef _SC_THREAD_SAFE_FUNCTIONS
1719 {
1720 _SC_THREAD_SAFE_FUNCTIONS, "POSIX_THREAD_SAFE_FUNCTIONS",
1721 SYSCONF, NOFLAGS
1722 },
1723 #endif /* _SC_THREAD_SAFE_FUNCTIONS */
1724 #ifdef _SC_THREAD_SAFE_FUNCTIONS
1725 {
1726 _SC_THREAD_SAFE_FUNCTIONS, "_POSIX_THREAD_SAFE_FUNCTIONS",
1727 SYSCONF, NOFLAGS
1728 },
1729 #endif /* _SC_THREAD_SAFE_FUNCTIONS */
1730
1731 #ifdef _SC_TTY_NAME_MAX
1732 {
1733 _SC_TTY_NAME_MAX, "TTY_NAME_MAX", SYSCONF, NOFLAGS
1734 },
1735 #endif /* _SC_TTY_NAME_MAX */
1736 #ifdef _SC_XOPEN_REALTIME
1737 {
1738 _SC_XOPEN_REALTIME, "_XOPEN_REALTIME", SYSCONF, NOFLAGS
1739 },
1740 #endif /* _SC_XOPEN_REALTIME */
1741 #ifdef _SC_XOPEN_REALTIME_THREADS
1742 {
1743 _SC_XOPEN_REALTIME_THREADS, "_XOPEN_REALTIME_THREADS", SYSCONF, NOFLAGS
1744 },
1745 #endif /* _SC_XOPEN_REALTIME_THREADS */
1746
1747 /*
1748 * Due to ambiguity in the standard we need
1749 * to recognize both the underscored name
1750 * and the non-underscored version in the
1751 * following variables.
1752 */
1753 #ifdef _SC_XBS5_ILP32_OFF32
1754 {
1755 _SC_XBS5_ILP32_OFF32, "XBS5_ILP32_OFF32", SYSCONF, NOFLAGS
1756 },
1757 #endif /* _SC_XBS5_ILP32_OFF32 */
1758 #ifdef _SC_XBS5_ILP32_OFF32
1759 {
1760 _SC_XBS5_ILP32_OFF32, "_XBS5_ILP32_OFF32", SYSCONF, NOFLAGS
1761 },
1762 #endif /* _SC_XBS5_ILP32_OFF32 */
1763
1764 #ifdef _SC_XBS5_ILP32_OFFBIG
1765 {
1766 _SC_XBS5_ILP32_OFFBIG, "XBS5_ILP32_OFFBIG", SYSCONF, NOFLAGS
1767 },
1768 #endif /* _SC_XBS5_ILP32_OFFBIG */
1769 #ifdef _SC_XBS5_ILP32_OFFBIG
1770 {
1771 _SC_XBS5_ILP32_OFFBIG, "_XBS5_ILP32_OFFBIG", SYSCONF, NOFLAGS
1772 },
1773 #endif /* _SC_XBS5_ILP32_OFFBIG */
1774
1775 #ifdef _SC_XBS5_LP64_OFF64
1776 {
1777 _SC_XBS5_LP64_OFF64, "XBS5_LP64_OFF64", SYSCONF, NOFLAGS
1778 },
1779 #endif /* _SC_XBS5_LP64_OFF64 */
1780 #ifdef _SC_XBS5_LP64_OFF64
1781 {
1782 _SC_XBS5_LP64_OFF64, "_XBS5_LP64_OFF64", SYSCONF, NOFLAGS
1783 },
1784 #endif /* _SC_XBS5_LP64_OFF64 */
1785
1786 #ifdef _SC_XBS5_LPBIG_OFFBIG
1787 {
1788 _SC_XBS5_LPBIG_OFFBIG, "XBS5_LPBIG_OFFBIG", SYSCONF, NOFLAGS
1789 },
1790 #endif /* _SC_XBS5_LPBIG_OFFBIG */
1791 #ifdef _SC_XBS5_LPBIG_OFFBIG
1792 {
1793 _SC_XBS5_LPBIG_OFFBIG, "_XBS5_LPBIG_OFFBIG", SYSCONF, NOFLAGS
1794 },
1795 #endif /* _SC_XBS5_LPBIG_OFFBIG */
1796
1797 /*
1798 * UNIX 03 additions for sysconf() names, and names that are not in interfaces
1799 */
1800 #ifdef _SC_REGEXP
1801 {
1802 _SC_REGEXP, "_POSIX_REGEXP", SYSCONF, NOFLAGS
1803 },
1804 #endif /* _SC_REGEXP */
1805 #ifdef _SC_SHELL
1806 {
1807 _SC_SHELL, "_POSIX_SHELL", SYSCONF, NOFLAGS
1808 },
1809 #endif /* _SC_SHELL */
1810 #ifdef _SC_HOST_NAME_MAX
1811 {
1812 _SC_HOST_NAME_MAX, "HOST_NAME_MAX", SYSCONF, NOFLAGS
1813 },
1814 #endif /* _SC_HOST_NAME_MAX */
1815 #ifdef _SC_READER_WRITER_LOCKS
1816 {
1817 _SC_READER_WRITER_LOCKS, "_POSIX_READER_WRITER_LOCKS", SYSCONF, NOFLAGS
1818 },
1819 #endif /* _SC_READER_WRITER_LOCKS */
1820 #ifdef _SC_IPV6
1821 {
1822 _SC_IPV6, "_POSIX_IPV6", SYSCONF, NOFLAGS
1823 },
1824 #endif /* _SC_IPV6 */
1825 #ifdef _SC_RAW_SOCKETS
1826 {
1827 _SC_RAW_SOCKETS, "_POSIX_RAW_SOCKETS", SYSCONF, NOFLAGS
1828 },
1829 #endif /* _SC_RAW_SOCKETS */
1830 #ifdef _SC_XOPEN_STREAMS
1831 {
1832 _SC_XOPEN_STREAMS, "_XOPEN_STREAMS", SYSCONF, NOFLAGS
1833 },
1834 #endif /* _SC_XOPEN_STREAMS */
1835 #ifdef _SC_SYMLOOP_MAX
1836 {
1837 _SC_SYMLOOP_MAX, "SYMLOOP_MAX", SYSCONF, NOFLAGS,
1838 20
1839 },
1840 #endif /* _SC_SYMLOOP_MAX */
1841 #ifdef _SC_2_PBS
1842 {
1843 _SC_2_PBS, "_POSIX2_PBS", SYSCONF, NOFLAGS
1844 },
1845 #endif /* _SC_2_PBS */
1846 #ifdef _SC_2_PBS_ACCOUNTING
1847 {
1848 _SC_2_PBS_ACCOUNTING, "_POSIX2_PBS_ACCOUNTING", SYSCONF, NOFLAGS
1849 },
1850 #endif /* _SC_2_PBS_ACCOUNTING */
1851 #ifdef _SC_2_PBS_CHECKPOINT
1852 {
1853 _SC_2_PBS_CHECKPOINT, "_POSIX2_PBS_CHECKPOINT", SYSCONF, NOFLAGS
1854 },
1855 #endif /* _SC_2_PBS_CHECKPOINT */
1856 #ifdef _SC_2_PBS_LOCATE
1857 {
1858 _SC_2_PBS_LOCATE, "_POSIX2_PBS_LOCATE", SYSCONF, NOFLAGS
1859 },
1860 #endif /* _SC_2_PBS_LOCATE */
1861 #ifdef _SC_2_PBS_MESSAGE
1862 {
1863 _SC_2_PBS_MESSAGE, "_POSIX2_PBS_MESSAGE", SYSCONF, NOFLAGS
1864 },
1865 #endif /* _SC_2_PBS_MESSAGE */
1866 #ifdef _SC_2_PBS_TRACK
1867 {
1868 _SC_2_PBS_TRACK, "_POSIX2_PBS_TRACK", SYSCONF, NOFLAGS
1869 },
1870 #endif /* _SC_2_PBS_TRACK */
1871
1872 #ifdef _SC_ADVISORY_INFO
1873 {
1874 _SC_ADVISORY_INFO, "_POSIX_ADVISORY_INFO", SYSCONF, NOFLAGS
1875 },
1876 #endif /* _SC_ADVISORY_INFO */
1877 #ifdef _SC_BARRIERS
1878 {
1879 _SC_BARRIERS, "_POSIX_BARRIERS", SYSCONF, NOFLAGS
1880 },
1881 #endif /* _SC_BARRIERS */
1882 #ifdef _SC_CLOCK_SELECTION
1883 {
1884 _SC_CLOCK_SELECTION, "_POSIX_CLOCK_SELECTION", SYSCONF, NOFLAGS
1885 },
1886 #endif /* _SC_CLOCK_SELECTION */
1887 #ifdef _SC_CPUTIME
1888 {
1889 _SC_CPUTIME, "_POSIX_CPUTIME", SYSCONF, NOFLAGS
1890 },
1891 #endif /* _SC_CPUTIME */
1892 #ifdef _SC_MONOTONIC_CLOCK
1893 {
1894 _SC_MONOTONIC_CLOCK, "_POSIX_MONOTONIC_CLOCK", SYSCONF, NOFLAGS
1895 },
1896 #endif /* _SC_MONOTONIC_CLOCK */
1897 #ifdef _SC_SPAWN
1898 {
1899 _SC_SPAWN, "_POSIX_SPAWN", SYSCONF, NOFLAGS
1900 },
1901 #endif /* _SC_SPAWN */
1902 #ifdef _SC_SPIN_LOCKS
1903 {
1904 _SC_SPIN_LOCKS, "_POSIX_SPIN_LOCKS", SYSCONF, NOFLAGS
1905 },
1906 #endif /* _SC_SPIN_LOCKS */
1907 #ifdef _SC_SPORADIC_SERVER
1908 {
1909 _SC_SPORADIC_SERVER, "_POSIX_SPORADIC_SERVER", SYSCONF, NOFLAGS
1910 },
1911 #endif /* _SC_SPORADIC_SERVER */
1912 #ifdef _SC_SS_REPL_MAX
1913 {
1914 _SC_SS_REPL_MAX, "_POSIX_SS_REPL_MAX", SYSCONF, NOFLAGS
1915 },
1916 #endif /* _SC_SS_REPL_MAX */
1917 #ifdef _SC_THREAD_CPUTIME
1918 {
1919 _SC_THREAD_CPUTIME, "_POSIX_THREAD_CPUTIME", SYSCONF, NOFLAGS
1920 },
1921 #endif /* _SC_THREAD_CPUTIME */
1922 #ifdef _SC_THREAD_SPORADIC_SERVER
1923 {
1924 _SC_THREAD_SPORADIC_SERVER, "_POSIX_THREAD_SPORADIC_SERVER", SYSCONF,
1925 NOFLAGS
1926 },
1927 #endif /* _SC_THREAD_SPORADIC_SERVER */
1928 #ifdef _SC_TIMEOUTS
1929 {
1930 _SC_TIMEOUTS, "_POSIX_TIMEOUTS", SYSCONF, NOFLAGS
1931 },
1932 #endif /* _SC_TIMEOUTS */
1933 #ifdef _SC_TRACE
1934 {
1935 _SC_TRACE, "_POSIX_TRACE", SYSCONF, NOFLAGS
1936 },
1937 #endif /* _SC_TRACE */
1938 #ifdef _SC_TRACE_EVENT_FILTER
1939 {
1940 _SC_TRACE_EVENT_FILTER, "_POSIX_TRACE_EVENT_FILTER", SYSCONF, NOFLAGS
1941 },
1942 #endif /* _SC_TRACE_EVENT_FILTER */
1943 #ifdef _SC_TRACE_EVENT_NAME_MAX
1944 {
1945 _SC_TRACE_EVENT_NAME_MAX, "_POSIX_TRACE_EVENT_NAME_MAX", SYSCONF,
1946 NOFLAGS
1947 },
1948 #endif /* _SC_TRACE_EVENT_NAME_MAX */
1949 #ifdef _SC_TRACE_INHERIT
1950 {
1951 _SC_TRACE_INHERIT, "_POSIX_TRACE_INHERIT", SYSCONF, NOFLAGS
1952 },
1953 #endif /* _SC_TRACE_INHERIT */
1954 #ifdef _SC_TRACE_LOG
1955 {
1956 _SC_TRACE_LOG, "_POSIX_TRACE_LOG", SYSCONF, NOFLAGS
1957 },
1958 #endif /* _SC_TRACE_LOG */
1959 #ifdef _SC_TRACE_NAME_MAX
1960 {
1961 _SC_TRACE_NAME_MAX, "_POSIX_TRACE_NAME_MAX", SYSCONF, NOFLAGS
1962 },
1963 #endif /* _SC_TRACE_NAME_MAX */
1964 #ifdef _SC_TRACE_SYS_MAX
1965 {
1966 _SC_TRACE_SYS_MAX, "_POSIX_TRACE_SYS_MAX", SYSCONF, NOFLAGS
1967 },
1968 #endif /* _SC_TRACE_SYS_MAX */
1969 #ifdef _SC_TRACE_USER_EVENT_MAX
1970 {
1971 _SC_TRACE_USER_EVENT_MAX, "_POSIX_TRACE_USER_EVENT_MAX", SYSCONF,
1972 NOFLAGS
1973 },
1974 #endif /* _SC_TRACE_USER_EVENT_MAX */
1975 #ifdef _SC_TYPED_MEMORY_OBJECTS
1976 {
1977 _SC_TYPED_MEMORY_OBJECTS, "_POSIX_TYPED_MEMORY_OBJECTS", SYSCONF,
1978 NOFLAGS
1979 },
1980 #endif /* _SC_TYPED_MEMORY_OBJECTS */
1981
1982 /*
1983 * Due to an ambiguity in the specification, we need to recognize both
1984 * the underscored POSIX name and the non-underscored name. In addition,
1985 * we need to permit the use of the _V6_* environment names specified
1986 * in unistd.h.
1987 */
1988 #ifdef _SC_V6_ILP32_OFF32
1989 {
1990 _SC_V6_ILP32_OFF32, "_V6_ILP32_OFF32", SYSCONF, NOFLAGS
1991 },
1992 #endif /* _SC_V6_ILP32_OFF32 */
1993 #ifdef _SC_V6_ILP32_OFF32
1994 {
1995 _SC_V6_ILP32_OFF32, "_POSIX_V6_ILP32_OFF32", SYSCONF, NOFLAGS
1996 },
1997 #endif /* _SC_V6_ILP32_OFF32 */
1998 #ifdef _SC_V6_ILP32_OFF32
1999 {
2000 _SC_V6_ILP32_OFF32, "POSIX_V6_ILP32_OFF32", SYSCONF, NOFLAGS
2001 },
2002 #endif /* _SC_V6_ILP32_OFF32 */
2003
2004 #ifdef _SC_V6_ILP32_OFFBIG
2005 {
2006 _SC_V6_ILP32_OFFBIG, "_V6_ILP32_OFFBIG", SYSCONF, NOFLAGS
2007 },
2008 #endif /* _SC_V6_ILP32_OFFBIG */
2009 #ifdef _SC_V6_ILP32_OFFBIG
2010 {
2011 _SC_V6_ILP32_OFFBIG, "_POSIX_V6_ILP32_OFFBIG", SYSCONF, NOFLAGS
2012 },
2013 #endif /* _SC_V6_ILP32_OFFBIG */
2014 #ifdef _SC_V6_ILP32_OFFBIG
2015 {
2016 _SC_V6_ILP32_OFFBIG, "POSIX_V6_ILP32_OFFBIG", SYSCONF, NOFLAGS
2017 },
2018 #endif /* _SC_V6_ILP32_OFFBIG */
2019
2020 #ifdef _SC_V6_LP64_OFF64
2021 {
2022 _SC_V6_LP64_OFF64, "_V6_LP64_OFF64", SYSCONF, NOFLAGS
2023 },
2024 #endif /* _SC_V6_LP64_OFF64 */
2025 #ifdef _SC_V6_LP64_OFF64
2026 {
2027 _SC_V6_LP64_OFF64, "_POSIX_V6_LP64_OFF64", SYSCONF, NOFLAGS
2028 },
2029 #endif /* _SC_V6_LP64_OFF64 */
2030 #ifdef _SC_V6_LP64_OFF64
2031 {
2032 _SC_V6_LP64_OFF64, "POSIX_V6_LP64_OFF64", SYSCONF, NOFLAGS
2033 },
2034 #endif /* _SC_V6_LP64_OFF64 */
2035
2036 #ifdef _SC_V6_LPBIG_OFFBIG
2037 {
2038 _SC_V6_LPBIG_OFFBIG, "_V6_LPBIG_OFFBIG", SYSCONF, NOFLAGS
2039 },
2040 #endif /* _SC_V6_LPBIG_OFFBIG */
2041 #ifdef _SC_V6_LPBIG_OFFBIG
2042 {
2043 _SC_V6_LPBIG_OFFBIG, "_POSIX_V6_LPBIG_OFFBIG", SYSCONF, NOFLAGS
2044 },
2045 #endif /* _SC_V6_LPBIG_OFFBIG */
2046 #ifdef _SC_V6_LPBIG_OFFBIG
2047 {
2048 _SC_V6_LPBIG_OFFBIG, "POSIX_V6_LPBIG_OFFBIG", SYSCONF, NOFLAGS
2049 },
2050 #endif /* _SC_V6_LPBIG_OFFBIG */
2051
2052 /* local values */
2053 {
2054 HEIRLOOM_TOOLCHEST_VERSION, "HEIRLOOM_TOOLCHEST_VERSION",
2055 SELFCONF, NOFLAGS
2056 },
2057 {
2058 0, NULL, 0, 0 /* end of table */
2059 }
2060 };
2061
2062
2063 /*
2064 * Print usage message.
2065 */
2066 static int
usage(void)2067 usage(void)
2068 {
2069
2070 fprintf(stderr,
2071 "usage:\t%s [-v specification] system_var\n"
2072 "\t%s [-v specification] path_var pathname\n"
2073 "\t%s -a\n", progname, progname, progname);
2074 return (2);
2075 }
2076
2077
2078 static int
namecmp(const void * a,const void * b)2079 namecmp(const void *a, const void *b)
2080 {
2081 return (strcoll(((const struct sctab *)a)->name,
2082 ((const struct sctab *)b)->name));
2083 }
2084
2085
2086 static int
getconf(struct sctab * scp,int argc,char * name,char * file)2087 getconf(struct sctab *scp, int argc, char *name, char *file)
2088 {
2089 register size_t len;
2090 register char *buffer;
2091 long value;
2092
2093 switch (scp->type) {
2094 case SELFCONF:
2095 if (argc > 2)
2096 return (usage());
2097 if (scp->flag & UNDEFINED ||
2098 (!(scp->flag&UNSIGNED_VALUE) && scp->value == -1)) {
2099 printf("undefined\n");
2100 } else
2101 if (scp->flag & UNSIGNED_VALUE)
2102 printf("%lu\n", scp->value);
2103 else
2104 printf("%ld\n", scp->value);
2105 break;
2106
2107 case SYSCONF:
2108 if (argc > 2)
2109 return (usage());
2110 errno = 0;
2111 if (scp->flag & UNDEFINED ||
2112 (value = sysconf((int)scp->value)) == -1) {
2113 if (scp->dfl) {
2114 printf("%ld\n", scp->dfl);
2115 } else if (errno == EINVAL) {
2116 fprintf(stderr, INVAL_ARG, progname, name);
2117 return (1);
2118 } else {
2119 printf("undefined\n");
2120 return (0);
2121 }
2122 } else
2123 printf("%ld\n", value);
2124 break;
2125
2126 case CONFSTR:
2127 if (argc > 2)
2128 return (usage());
2129 errno = 0;
2130 len = confstr((int)scp->value, NULL, (size_t)0);
2131 if (len == 0) {
2132 if (errno == EINVAL) {
2133 fprintf(stderr, INVAL_ARG,
2134 progname, name);
2135 return (1);
2136 } else {
2137 printf("undefined\n");
2138 return (0);
2139 }
2140 }
2141 /*
2142 * allocate space to store result of constr() into
2143 */
2144 if ((buffer = malloc(len)) == NULL) {
2145 fprintf(stderr, "insufficient memory available\n");
2146 return (1);
2147 }
2148
2149 if (confstr((int)scp->value, buffer, len) == 0) {
2150 fprintf(stderr, "confstr() behavior not consistent\n");
2151 return (1);
2152 }
2153
2154 printf("%s\n", buffer);
2155 free(buffer);
2156 break;
2157
2158 case PATHCONF:
2159 if (argc != 3)
2160 return (usage());
2161 errno = 0;
2162 if ((value = pathconf(file, (int)scp->value)) == -1) {
2163 if (errno == EINVAL || errno == 0) {
2164 /* Does not support the association */
2165 printf("undefined\n");
2166 return (0);
2167 } else {
2168 /* Probably problems with the pathname itself */
2169 if (aflag) {
2170 printf("%s\n", file);
2171 } else {
2172 printf("%s", file);
2173 }
2174 return (1);
2175 }
2176 }
2177 printf("%ld\n", value);
2178 break;
2179 case PATHVAR:
2180 buffer = NULL;
2181 #ifdef _CS_PATH
2182 if ((len = confstr(_CS_PATH, NULL, 0)) == 0 ||
2183 (buffer = malloc(len)) == NULL ||
2184 confstr(_CS_PATH, buffer, len) == 0)
2185 buffer = NULL;
2186 #endif /* _CS_PATH */
2187 printf("%s:%s\n", HEIRLOOM_PATH,
2188 buffer ? buffer : "/bin:/usr/bin");
2189 break;
2190 }
2191 return (0);
2192 }
2193
2194 int
main(int argc,char ** argv)2195 main(int argc, char **argv)
2196 {
2197 register struct sctab *scp;
2198 int c;
2199 int exstat = 0;
2200
2201 progname = basename(argv[0]);
2202 while ((c = getopt(argc, argv, "av:")) != -1)
2203 switch (c) {
2204 case 'a':
2205 aflag = 1;
2206 break;
2207 case 'v':
2208 /*
2209 * Unix98 adds the -v option to allow
2210 * programming 'specifications' to be
2211 * indicated, for present purposes
2212 * the specification isn't really
2213 * doing anything of value, so for
2214 * the moment getopt just processes the
2215 * option value and argv[1] is adjusted.
2216 *
2217 * At some later date we might want to
2218 * do specification processing at this
2219 * point.
2220 */
2221 break;
2222 case '?':
2223 return (usage());
2224 }
2225 argc -= optind-1;
2226 argv += optind-1;
2227
2228 if ((aflag && argc >= 2) || (!aflag && argc < 2))
2229 return (usage());
2230 if (aflag) {
2231
2232 #define TabStop 8
2233 #define RightColumn 32
2234 #define DefPathName "."
2235
2236 /*
2237 * sort the table by the "name" field
2238 * so we print it in sorted order
2239 */
2240 qsort(&sctab[0], (sizeof (sctab)/sizeof (struct sctab))-1,
2241 sizeof (struct sctab), namecmp);
2242
2243 /*
2244 * print all the known symbols and their values
2245 */
2246 for (scp = &sctab[0]; scp->name != NULL; ++scp) {
2247 int stat;
2248
2249 /*
2250 * create 2 columns:
2251 * variable name in the left column,
2252 * value in the right column.
2253 * The right column starts at a tab stop.
2254 */
2255 printf("%s:\t", scp->name);
2256
2257 c = strlen(scp->name) + 1;
2258 c = (c+TabStop) / TabStop, c *= TabStop;
2259 for (; c < RightColumn; c += TabStop)
2260 putchar('\t');
2261
2262 /*
2263 * for pathconf() related variables that require
2264 * a pathname, use "."
2265 */
2266 stat = getconf(scp, scp->type == PATHCONF ? 3 : 2,
2267 scp->name, DefPathName);
2268
2269 exstat |= stat;
2270
2271 /*
2272 * if stat != 0, then an error message was already
2273 * printed in getconf(),
2274 * so don't need to print one here
2275 */
2276 }
2277 } else {
2278
2279 /*
2280 * find the name of the specified variable (argv[1])
2281 * and print its value.
2282 */
2283 for (scp = &sctab[0]; scp->name != NULL; ++scp)
2284 if (strcmp(argv[1], scp->name) == 0) {
2285 exstat = getconf(scp, argc, argv[1], argv[2]);
2286 break;
2287 }
2288
2289 /*
2290 * if at last entry in table, then the user specified
2291 * variable is invalid
2292 */
2293 if (scp->name == NULL) {
2294 errno = EINVAL;
2295 fprintf(stderr, INVAL_ARG, progname, argv[1]);
2296 return (1);
2297 }
2298 }
2299 return (exstat);
2300 }
2301