1 /* $OpenBSD: getconf.c,v 1.23 2022/12/04 23:50:48 cheloha Exp $ */
2
3 /*-
4 * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by J.T. Conklin.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by Winning Strategies, Inc.
21 * 4. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36 /*
37 * POSIX.2 getconf utility
38 *
39 * Written by:
40 * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
41 */
42
43 #include <err.h>
44 #include <errno.h>
45 #include <limits.h>
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <string.h>
49 #include <unistd.h>
50
51 static void __dead usage(void);
52 static void list_var(int);
53 static int compilation_spec_valid(const char *);
54
55 struct conf_variable
56 {
57 const char *name;
58 enum { SYSCONF, CONFSTR, PATHCONF, CONSTANT } type;
59 long value;
60 };
61
62
63 #define constant_row(name) { #name, CONSTANT, name },
64 #define sysconf_row(name) { #name, SYSCONF, _SC_##name },
65 #define pathconf_row(name) { #name, PATHCONF, _PC_##name },
66 #define confstr_row(name) { #name, CONFSTR, _CS_##name },
67 #define posix_constant_row(name) { #name, CONSTANT, _POSIX_##name },
68 #define posix_confstr_row(name) { #name, CONFSTR, _CS_POSIX_##name },
69 #define compat_posix2_sysconf_row(name) { #name, SYSCONF, _SC_2_##name },
70 #define compat_posix2_constant_row(name) { #name, CONSTANT, _POSIX2_##name },
71
72 /* Some sysconf variables don't follow the pattern of the others */
73 #define posix2_sysconf_row(name) \
74 { "_POSIX2_" #name, SYSCONF, _SC_2_##name },
75 #define posix2_pathconf_row(name) \
76 { "_POSIX2_" #name, PATHCONF, _PC_2_##name },
77 #define pthread_sysconf_row(name) \
78 { "_PTHREAD_" #name, SYSCONF, _SC_THREAD_##name },
79 #define xopen_sysconf_row(name) \
80 { "_XOPEN_" #name, SYSCONF, _SC_XOPEN_##name },
81
82 const struct conf_variable conf_table[] =
83 {
84 /* Configuration strings */
85 confstr_row(PATH)
86 confstr_row(V7_ENV)
87 confstr_row(V6_ENV)
88
89 /* Symbolic Utility Limits */
90 sysconf_row(BC_BASE_MAX)
91 sysconf_row(BC_DIM_MAX)
92 sysconf_row(BC_SCALE_MAX)
93 sysconf_row(BC_STRING_MAX)
94 sysconf_row(COLL_WEIGHTS_MAX)
95 sysconf_row(EXPR_NEST_MAX)
96 sysconf_row(LINE_MAX)
97 sysconf_row(RE_DUP_MAX)
98
99 /* POSIX.1 Configurable System Variables */
100 sysconf_row(AIO_LISTIO_MAX)
101 sysconf_row(AIO_MAX)
102 sysconf_row(AIO_PRIO_DELTA_MAX)
103 sysconf_row(ARG_MAX)
104 sysconf_row(CHILD_MAX)
105 sysconf_row(CLK_TCK)
106 sysconf_row(NGROUPS_MAX)
107 sysconf_row(OPEN_MAX)
108 sysconf_row(STREAM_MAX)
109 sysconf_row(TZNAME_MAX)
110 sysconf_row(PAGE_SIZE)
111 sysconf_row(PAGESIZE)
112
113 sysconf_row(SEM_NSEMS_MAX)
114 sysconf_row(SEM_VALUE_MAX)
115 sysconf_row(HOST_NAME_MAX)
116 sysconf_row(LOGIN_NAME_MAX)
117
118 sysconf_row(ATEXIT_MAX)
119 sysconf_row(DELAYTIMER_MAX)
120 sysconf_row(IOV_MAX)
121 sysconf_row(MQ_OPEN_MAX)
122 sysconf_row(MQ_PRIO_MAX)
123 sysconf_row(RTSIG_MAX)
124 sysconf_row(SIGQUEUE_MAX)
125 sysconf_row(SYMLOOP_MAX)
126 sysconf_row(TIMER_MAX)
127 sysconf_row(TTY_NAME_MAX)
128
129 posix2_sysconf_row(PBS)
130 posix2_sysconf_row(PBS_ACCOUNTING)
131 posix2_sysconf_row(PBS_CHECKPOINT)
132 posix2_sysconf_row(PBS_LOCATE)
133 posix2_sysconf_row(PBS_MESSAGE)
134 posix2_sysconf_row(PBS_TRACK)
135
136 pthread_sysconf_row(DESTRUCTOR_ITERATIONS)
137 pthread_sysconf_row(KEYS_MAX)
138 pthread_sysconf_row(STACK_MIN)
139 pthread_sysconf_row(THREADS_MAX)
140
141 xopen_sysconf_row(SHM)
142 xopen_sysconf_row(CRYPT)
143 xopen_sysconf_row(ENH_I18N)
144 xopen_sysconf_row(REALTIME)
145 xopen_sysconf_row(REALTIME_THREADS)
146 xopen_sysconf_row(STREAMS)
147 xopen_sysconf_row(UNIX)
148 xopen_sysconf_row(UUCP)
149 xopen_sysconf_row(VERSION)
150
151 pathconf_row(FILESIZEBITS)
152 pathconf_row(LINK_MAX)
153 pathconf_row(MAX_CANON)
154 pathconf_row(MAX_INPUT)
155 pathconf_row(NAME_MAX)
156 pathconf_row(PATH_MAX)
157 pathconf_row(PIPE_BUF)
158 pathconf_row(SYMLINK_MAX)
159
160 posix2_pathconf_row(SYMLINKS)
161
162 constant_row(_POSIX2_CHARCLASS_NAME_MAX)
163 constant_row(_XOPEN_IOV_MAX)
164 constant_row(_XOPEN_NAME_MAX)
165 constant_row(_XOPEN_PATH_MAX)
166
167 /* Extensions */
168 sysconf_row(PHYS_PAGES)
169 sysconf_row(AVPHYS_PAGES)
170 sysconf_row(NPROCESSORS_CONF)
171 sysconf_row(NPROCESSORS_ONLN)
172
173 { NULL }
174 };
175
176 /*
177 * Lots of names have a leading "_POSIX_", so put them in a table with
178 * that prefix trimmed
179 */
180 const char uposix_prefix[] = "_POSIX_";
181 const struct conf_variable uposix_conf_table[] =
182 {
183 /* POSIX.1 Maximum Values */
184 posix_constant_row(CLOCKRES_MIN)
185
186 /* POSIX.1 Minimum Values */
187 /*posix_constant_row(AIO_LISTIO_MAX)*/
188 /*posix_constant_row(AIO_MAX)*/
189 posix_constant_row(ARG_MAX)
190 posix_constant_row(CHILD_MAX)
191 /*posix_constant_row(DELAYTIMER_MAX)*/
192 posix_constant_row(HOST_NAME_MAX)
193 posix_constant_row(LINK_MAX)
194 posix_constant_row(LOGIN_NAME_MAX)
195 posix_constant_row(MAX_CANON)
196 posix_constant_row(MAX_INPUT)
197 /*posix_constant_row(MQ_OPEN_MAX)*/
198 /*posix_constant_row(MQ_PRIO_MAX)*/
199 posix_constant_row(NAME_MAX)
200 posix_constant_row(NGROUPS_MAX)
201 posix_constant_row(OPEN_MAX)
202 posix_constant_row(PATH_MAX)
203 posix_constant_row(PIPE_BUF)
204 posix_constant_row(RE_DUP_MAX)
205 /*posix_constant_row(RTSIG_MAX)*/
206 posix_constant_row(SEM_NSEMS_MAX)
207 posix_constant_row(SEM_VALUE_MAX)
208 /*posix_constant_row(SIGQUEUE_MAX)*/
209 posix_constant_row(SSIZE_MAX)
210 /*posix_constant_row(SS_REPL_MAX)*/
211 posix_constant_row(STREAM_MAX)
212 posix_constant_row(SYMLINK_MAX)
213 posix_constant_row(SYMLOOP_MAX)
214 posix_constant_row(THREAD_DESTRUCTOR_ITERATIONS)
215 posix_constant_row(THREAD_KEYS_MAX)
216 posix_constant_row(THREAD_THREADS_MAX)
217 /*posix_constant_row(TIMER_MAX)*/
218 posix_constant_row(TTY_NAME_MAX)
219 posix_constant_row(TZNAME_MAX)
220
221 /* POSIX.1 Configurable System Variables */
222 sysconf_row(JOB_CONTROL)
223 sysconf_row(SAVED_IDS)
224 sysconf_row(VERSION)
225 sysconf_row(FSYNC)
226 sysconf_row(MONOTONIC_CLOCK)
227 sysconf_row(THREAD_SAFE_FUNCTIONS)
228 sysconf_row(ADVISORY_INFO)
229 sysconf_row(BARRIERS)
230 sysconf_row(ASYNCHRONOUS_IO)
231 sysconf_row(CLOCK_SELECTION)
232 sysconf_row(CPUTIME)
233 sysconf_row(IPV6)
234 sysconf_row(MAPPED_FILES)
235 sysconf_row(MEMLOCK)
236 sysconf_row(MEMLOCK_RANGE)
237 sysconf_row(MEMORY_PROTECTION)
238 sysconf_row(MESSAGE_PASSING)
239 sysconf_row(PRIORITIZED_IO)
240 sysconf_row(PRIORITY_SCHEDULING)
241 sysconf_row(RAW_SOCKETS)
242 sysconf_row(READER_WRITER_LOCKS)
243 sysconf_row(REALTIME_SIGNALS)
244 sysconf_row(REGEXP)
245 sysconf_row(SEMAPHORES)
246 sysconf_row(SHARED_MEMORY_OBJECTS)
247 sysconf_row(SHELL)
248 sysconf_row(SPAWN)
249 sysconf_row(SPIN_LOCKS)
250 sysconf_row(SPORADIC_SERVER)
251 sysconf_row(SS_REPL_MAX)
252 sysconf_row(SYNCHRONIZED_IO)
253 sysconf_row(THREAD_ATTR_STACKADDR)
254 sysconf_row(THREAD_ATTR_STACKSIZE)
255 sysconf_row(THREAD_CPUTIME)
256 sysconf_row(THREAD_PRIO_INHERIT)
257 sysconf_row(THREAD_PRIO_PROTECT)
258 sysconf_row(THREAD_PRIORITY_SCHEDULING)
259 sysconf_row(THREAD_PROCESS_SHARED)
260 sysconf_row(THREAD_ROBUST_PRIO_INHERIT)
261 sysconf_row(THREAD_SPORADIC_SERVER)
262 sysconf_row(THREADS)
263 sysconf_row(TIMEOUTS)
264 sysconf_row(TIMERS)
265 sysconf_row(TRACE)
266 sysconf_row(TRACE_EVENT_FILTER)
267 sysconf_row(TRACE_EVENT_NAME_MAX)
268 sysconf_row(TRACE_INHERIT)
269 sysconf_row(TRACE_LOG)
270 sysconf_row(TRACE_NAME_MAX)
271 sysconf_row(TRACE_SYS_MAX)
272 sysconf_row(TRACE_USER_EVENT_MAX)
273 sysconf_row(TYPED_MEMORY_OBJECTS)
274
275 /*
276 * If new compilation specification are added (V8_*?) then add them
277 * to the compilation_specs array below too
278 */
279 sysconf_row(V7_ILP32_OFF32)
280 sysconf_row(V7_ILP32_OFFBIG)
281 sysconf_row(V7_LP64_OFF64)
282 sysconf_row(V7_LPBIG_OFFBIG)
283 sysconf_row(V6_ILP32_OFF32)
284 sysconf_row(V6_ILP32_OFFBIG)
285 sysconf_row(V6_LP64_OFF64)
286 sysconf_row(V6_LPBIG_OFFBIG)
287
288 /* POSIX.1 Configurable Path Variables */
289 pathconf_row(CHOWN_RESTRICTED)
290 pathconf_row(NO_TRUNC)
291 pathconf_row(VDISABLE)
292 pathconf_row(ASYNC_IO)
293 pathconf_row(PRIO_IO)
294 pathconf_row(SYNC_IO)
295 pathconf_row(TIMESTAMP_RESOLUTION)
296
297 { NULL }
298 };
299
300 /*
301 * Then there are the "POSIX_*" values
302 */
303 const char posix_prefix[] = "POSIX_";
304 const struct conf_variable posix_conf_table[] =
305 {
306 pathconf_row(ALLOC_SIZE_MIN)
307 pathconf_row(REC_INCR_XFER_SIZE)
308 pathconf_row(REC_MAX_XFER_SIZE)
309 pathconf_row(REC_MIN_XFER_SIZE)
310 pathconf_row(REC_XFER_ALIGN)
311
312 posix_confstr_row(V7_ILP32_OFF32_CFLAGS)
313 posix_confstr_row(V7_ILP32_OFF32_LDFLAGS)
314 posix_confstr_row(V7_ILP32_OFF32_LIBS)
315 posix_confstr_row(V7_ILP32_OFFBIG_CFLAGS)
316 posix_confstr_row(V7_ILP32_OFFBIG_LDFLAGS)
317 posix_confstr_row(V7_ILP32_OFFBIG_LIBS)
318 posix_confstr_row(V7_LP64_OFF64_CFLAGS)
319 posix_confstr_row(V7_LP64_OFF64_LDFLAGS)
320 posix_confstr_row(V7_LP64_OFF64_LIBS)
321 posix_confstr_row(V7_LPBIG_OFFBIG_CFLAGS)
322 posix_confstr_row(V7_LPBIG_OFFBIG_LDFLAGS)
323 posix_confstr_row(V7_LPBIG_OFFBIG_LIBS)
324 posix_confstr_row(V7_THREADS_CFLAGS)
325 posix_confstr_row(V7_THREADS_LDFLAGS)
326 posix_confstr_row(V7_WIDTH_RESTRICTED_ENVS)
327 posix_confstr_row(V6_ILP32_OFF32_CFLAGS)
328 posix_confstr_row(V6_ILP32_OFF32_LDFLAGS)
329 posix_confstr_row(V6_ILP32_OFF32_LIBS)
330 posix_confstr_row(V6_ILP32_OFFBIG_CFLAGS)
331 posix_confstr_row(V6_ILP32_OFFBIG_LDFLAGS)
332 posix_confstr_row(V6_ILP32_OFFBIG_LIBS)
333 posix_confstr_row(V6_LP64_OFF64_CFLAGS)
334 posix_confstr_row(V6_LP64_OFF64_LDFLAGS)
335 posix_confstr_row(V6_LP64_OFF64_LIBS)
336 posix_confstr_row(V6_LPBIG_OFFBIG_CFLAGS)
337 posix_confstr_row(V6_LPBIG_OFFBIG_LDFLAGS)
338 posix_confstr_row(V6_LPBIG_OFFBIG_LIBS)
339 posix_confstr_row(V6_WIDTH_RESTRICTED_ENVS)
340
341 { NULL }
342 };
343
344 /*
345 * Finally, there are variables that are accepted with a prefix
346 * of either "_POSIX2_" or "POSIX2_"
347 */
348 const char compat_posix2_prefix[] = "POSIX2_";
349 const struct conf_variable compat_posix2_conf_table[] =
350 {
351 /* Optional Facility Configuration Values */
352 compat_posix2_sysconf_row(VERSION)
353 compat_posix2_sysconf_row(C_BIND)
354 compat_posix2_sysconf_row(C_DEV)
355 compat_posix2_sysconf_row(CHAR_TERM)
356 compat_posix2_sysconf_row(FORT_DEV)
357 compat_posix2_sysconf_row(FORT_RUN)
358 compat_posix2_sysconf_row(LOCALEDEF)
359 compat_posix2_sysconf_row(SW_DEV)
360 compat_posix2_sysconf_row(UPE)
361
362 /* Utility Limit Minimum Values */
363 compat_posix2_constant_row(BC_BASE_MAX)
364 compat_posix2_constant_row(BC_DIM_MAX)
365 compat_posix2_constant_row(BC_SCALE_MAX)
366 compat_posix2_constant_row(BC_STRING_MAX)
367 compat_posix2_constant_row(COLL_WEIGHTS_MAX)
368 compat_posix2_constant_row(EXPR_NEST_MAX)
369 compat_posix2_constant_row(LINE_MAX)
370 compat_posix2_constant_row(RE_DUP_MAX)
371
372 { NULL }
373 };
374
375 #undef constant_row
376 #undef sysconf_row
377 #undef pathconf_row
378 #undef confstr_row
379 #undef posix_constant_row
380 #undef posix_confstr_row
381 #undef compat_posix2_sysconf_row
382 #undef compat_posix2_constant_row
383
384
385 /*
386 * What values are possibly accepted by the -v option?
387 * These are implied to have a prefix of posix_prefix
388 */
389 const char *compilation_specs[] = {
390 "V7_ILP32_OFF32",
391 "V7_ILP32_OFFBIG",
392 "V7_LP64_OFF64",
393 "V7_LPBIG_OFFBIG",
394 "V6_ILP32_OFF32",
395 "V6_ILP32_OFFBIG",
396 "V6_LP64_OFF64",
397 "V6_LPBIG_OFFBIG",
398 NULL
399 };
400
401 int
main(int argc,char * argv[])402 main(int argc, char *argv[])
403 {
404 int ch;
405 const struct conf_variable *cp;
406
407 long val;
408 size_t slen;
409 char * sval;
410
411 while ((ch = getopt(argc, argv, "lLv:")) != -1) {
412 switch (ch) {
413 case 'l': /* nonstandard: list system variables */
414 list_var(0);
415 return (0);
416 case 'L': /* nonstandard: list path variables */
417 list_var(1);
418 return (0);
419 case 'v':
420 if (! compilation_spec_valid(optarg))
421 errx(1, "%s: unknown specification", optarg);
422 break;
423 default:
424 usage();
425 }
426 }
427 argc -= optind;
428 argv += optind;
429
430 if (argc < 1 || argc > 2)
431 usage();
432
433 /* pick a table based on a possible prefix */
434 if (strncmp(*argv, uposix_prefix, sizeof(uposix_prefix) - 1) == 0) {
435 cp = uposix_conf_table;
436 slen = sizeof(uposix_prefix) - 1;
437 } else if (strncmp(*argv, posix_prefix,
438 sizeof(posix_prefix) - 1) == 0) {
439 cp = posix_conf_table;
440 slen = sizeof(posix_prefix) - 1;
441 } else {
442 cp = conf_table;
443 slen = 0;
444 }
445
446 /* scan the table */
447 for (; cp->name != NULL; cp++)
448 if (strcmp(*argv + slen, cp->name) == 0)
449 break;
450
451 /*
452 * If no match, then make a final check against
453 * compat_posix2_conf_table, with special magic to accept/skip
454 * a leading underbar
455 */
456 slen = argv[0][0] == '_';
457 if (cp->name == NULL && strncmp(*argv + slen, compat_posix2_prefix,
458 sizeof(compat_posix2_prefix) - 1) == 0) {
459 slen += sizeof(compat_posix2_prefix) - 1;
460 for (cp = compat_posix2_conf_table; cp->name != NULL; cp++) {
461 if (strcmp(*argv + slen, cp->name) == 0)
462 break;
463 }
464 }
465
466 if (cp->name == NULL)
467 errx(1, "%s: unknown variable", *argv);
468
469 if (cp->type == PATHCONF) {
470 if (argc != 2) usage();
471 } else {
472 if (argc != 1) usage();
473 }
474
475 switch (cp->type) {
476 case CONSTANT:
477 if (pledge("stdio", NULL) == -1)
478 err(1, "pledge");
479 printf("%ld\n", cp->value);
480 break;
481
482 case CONFSTR:
483 if (pledge("stdio", NULL) == -1)
484 err(1, "pledge");
485 errno = 0;
486 if ((slen = confstr(cp->value, NULL, 0)) == 0) {
487 if (errno != 0)
488 err(1, NULL);
489
490 printf("undefined\n");
491 } else {
492 if ((sval = malloc(slen)) == NULL)
493 err(1, NULL);
494
495 confstr(cp->value, sval, slen);
496 printf("%s\n", sval);
497 }
498 break;
499
500 case SYSCONF:
501 if (pledge("stdio ps vminfo", NULL) == -1)
502 err(1, "pledge");
503 errno = 0;
504 if ((val = sysconf(cp->value)) == -1) {
505 if (errno != 0)
506 err(1, NULL);
507
508 printf("undefined\n");
509 } else {
510 printf("%ld\n", val);
511 }
512 break;
513
514 case PATHCONF:
515 if (unveil(argv[1], "r") == -1)
516 err(1, "unveil %s", argv[1]);
517 if (pledge("stdio rpath", NULL) == -1)
518 err(1, "pledge");
519 errno = 0;
520 if ((val = pathconf(argv[1], cp->value)) == -1) {
521 if (errno != 0)
522 err(1, "%s", argv[1]);
523
524 printf("undefined\n");
525 } else {
526 printf("%ld\n", val);
527 }
528 break;
529 }
530
531 return ferror(stdout);
532 }
533
534
535 static void __dead
usage(void)536 usage(void)
537 {
538 extern char *__progname;
539
540 (void)fprintf(stderr,
541 "usage: %s [-Ll] [-v specification] name [pathname]\n",
542 __progname);
543 exit(1);
544 }
545
546 static void
list_var(int do_pathconf)547 list_var(int do_pathconf)
548 {
549 const struct conf_variable *cp;
550
551 for (cp = uposix_conf_table; cp->name != NULL; cp++)
552 if ((cp->type == PATHCONF) == do_pathconf)
553 printf("%s%s\n", uposix_prefix, cp->name);
554 for (cp = posix_conf_table; cp->name != NULL; cp++)
555 if ((cp->type == PATHCONF) == do_pathconf)
556 printf("%s%s\n", posix_prefix, cp->name);
557 for (cp = conf_table; cp->name != NULL; cp++)
558 if ((cp->type == PATHCONF) == do_pathconf)
559 printf("%s\n", cp->name);
560 for (cp = compat_posix2_conf_table; cp->name != NULL; cp++)
561 if ((cp->type == PATHCONF) == do_pathconf)
562 printf("_%s%s\n", compat_posix2_prefix, cp->name);
563 }
564
565 static int
compilation_spec_valid(const char * spec)566 compilation_spec_valid(const char *spec)
567 {
568 const char **sp;
569 const struct conf_variable *cp;
570
571 if (strncmp(spec, posix_prefix, sizeof(posix_prefix) - 1) != 0)
572 return (0);
573
574 spec += sizeof(posix_prefix) - 1;
575 for (sp = compilation_specs; *sp != NULL; sp++)
576 if (strcmp(spec, *sp) == 0)
577 break;
578 if (*sp == NULL)
579 return (0);
580
581 for (cp = uposix_conf_table; cp->name != NULL; cp++)
582 if (strcmp(spec, cp->name) == 0 && cp->type == SYSCONF)
583 return (sysconf(cp->value) != -1);
584
585 return (0);
586 }
587