libiconv: remove function, which is not available w/o libiconv a4 macros
[uclibc-ng.git] / utils / getconf.c
blob3dd3d75d952291e3a1541a1d928f634da74b846d
1 /* Copyright (C) 1991, 92, 1995-2008, 2009 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published
6 by the Free Software Foundation; version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 #define _GNU_SOURCE 1
18 #include "porting.h"
19 #include <unistd.h>
20 #include <errno.h>
21 #include <string.h>
22 #include <stdlib.h>
23 #include <stdio.h>
25 #define PACKAGE "getconf regression test"
26 #undef VERSION
27 #define VERSION ""
28 #define _(x) x
29 #define error(status, errnum, fmt, ...) \
30 {fprintf(stderr, fmt "\n", ## __VA_ARGS__); exit(status);}
33 struct conf
35 const char *name;
36 const int call_name;
37 const enum { SYSCONF, CONFSTR, PATHCONF } call;
40 static const struct conf vars[] =
42 #ifdef _PC_LINK_MAX
43 { "LINK_MAX", _PC_LINK_MAX, PATHCONF },
44 #endif
45 #ifdef _PC_LINK_MAX
46 { "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
47 #endif
48 #ifdef _PC_MAX_CANON
49 { "MAX_CANON", _PC_MAX_CANON, PATHCONF },
50 #endif
51 #ifdef _PC_MAX_CANON
52 { "_POSIX_MAX_CANON", _PC_MAX_CANON, PATHCONF },
53 #endif
54 #ifdef _PC_MAX_INPUT
55 { "MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
56 #endif
57 #ifdef _PC_MAX_INPUT
58 { "_POSIX_MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
59 #endif
60 #ifdef _PC_NAME_MAX
61 { "NAME_MAX", _PC_NAME_MAX, PATHCONF },
62 #endif
63 #ifdef _PC_NAME_MAX
64 { "_POSIX_NAME_MAX", _PC_NAME_MAX, PATHCONF },
65 #endif
66 #ifdef _PC_PATH_MAX
67 { "PATH_MAX", _PC_PATH_MAX, PATHCONF },
68 #endif
69 #ifdef _PC_PATH_MAX
70 { "_POSIX_PATH_MAX", _PC_PATH_MAX, PATHCONF },
71 #endif
72 #ifdef _PC_PIPE_BUF
73 { "PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
74 #endif
75 #ifdef _PC_PIPE_BUF
76 { "_POSIX_PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
77 #endif
78 #ifdef _PC_SOCK_MAXBUF
79 { "SOCK_MAXBUF", _PC_SOCK_MAXBUF, PATHCONF },
80 #endif
81 #ifdef _PC_ASYNC_IO
82 { "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF },
83 #endif
84 #ifdef _PC_CHOWN_RESTRICTED
85 { "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF },
86 #endif
87 #ifdef _PC_NO_TRUNC
88 { "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF },
89 #endif
90 #ifdef _PC_PRIO_IO
91 { "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF },
92 #endif
93 #ifdef _PC_SYNC_IO
94 { "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF },
95 #endif
96 #ifdef _PC_VDISABLE
97 { "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF },
98 #endif
100 #ifdef _SC_ARG_MAX
101 { "ARG_MAX", _SC_ARG_MAX, SYSCONF },
102 #endif
103 #ifdef _SC_ATEXIT_MAX
104 { "ATEXIT_MAX", _SC_ATEXIT_MAX, SYSCONF },
105 #endif
106 #ifdef _SC_CHAR_BIT
107 { "CHAR_BIT", _SC_CHAR_BIT, SYSCONF },
108 #endif
109 #ifdef _SC_CHAR_MAX
110 { "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
111 #endif
112 #ifdef _SC_CHAR_MIN
113 { "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
114 #endif
115 #ifdef _SC_CHILD_MAX
116 { "CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
117 #endif
118 #ifdef _SC_CLK_TCK
119 { "CLK_TCK", _SC_CLK_TCK, SYSCONF },
120 #endif
121 #ifdef _SC_INT_MAX
122 { "INT_MAX", _SC_INT_MAX, SYSCONF },
123 #endif
124 #ifdef _SC_INT_MIN
125 { "INT_MIN", _SC_INT_MIN, SYSCONF },
126 #endif
127 #ifdef _SC_UIO_MAXIOV
128 { "IOV_MAX", _SC_UIO_MAXIOV, SYSCONF },
129 #endif
130 #ifdef _SC_LOGIN_NAME_MAX
131 { "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
132 #endif
133 #ifdef _SC_LONG_BIT
134 { "LONG_BIT", _SC_LONG_BIT, SYSCONF },
135 #endif
136 #ifdef _SC_MB_LEN_MAX
137 { "MB_LEN_MAX", _SC_MB_LEN_MAX, SYSCONF },
138 #endif
139 #ifdef _SC_NGROUPS_MAX
140 { "NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
141 #endif
142 #ifdef _SC_NL_ARGMAX
143 { "NL_ARGMAX", _SC_NL_ARGMAX, SYSCONF },
144 #endif
145 #ifdef _SC_NL_LANGMAX
146 { "NL_LANGMAX", _SC_NL_LANGMAX, SYSCONF },
147 #endif
148 #ifdef _SC_NL_MSGMAX
149 { "NL_MSGMAX", _SC_NL_MSGMAX, SYSCONF },
150 #endif
151 #ifdef _SC_NL_NMAX
152 { "NL_NMAX", _SC_NL_NMAX, SYSCONF },
153 #endif
154 #ifdef _SC_NL_SETMAX
155 { "NL_SETMAX", _SC_NL_SETMAX, SYSCONF },
156 #endif
157 #ifdef _SC_NL_TEXTMAX
158 { "NL_TEXTMAX", _SC_NL_TEXTMAX, SYSCONF },
159 #endif
160 #ifdef _SC_GETGR_R_SIZE_MAX
161 { "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
162 #endif
163 #ifdef _SC_GETPW_R_SIZE_MAX
164 { "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
165 #endif
166 #ifdef _SC_NZERO
167 { "NZERO", _SC_NZERO, SYSCONF },
168 #endif
169 #ifdef _SC_OPEN_MAX
170 { "OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
171 #endif
172 #ifdef _SC_PAGESIZE
173 { "PAGESIZE", _SC_PAGESIZE, SYSCONF },
174 #endif
175 #ifdef _SC_PAGESIZE
176 { "PAGE_SIZE", _SC_PAGESIZE, SYSCONF },
177 #endif
178 #ifdef _SC_PASS_MAX
179 { "PASS_MAX", _SC_PASS_MAX, SYSCONF },
180 #endif
181 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
182 { "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
183 #endif
184 #ifdef _SC_THREAD_KEYS_MAX
185 { "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
186 #endif
187 #ifdef _SC_THREAD_STACK_MIN
188 { "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
189 #endif
190 #ifdef _SC_THREAD_THREADS_MAX
191 { "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
192 #endif
193 #ifdef _SC_SCHAR_MAX
194 { "SCHAR_MAX", _SC_SCHAR_MAX, SYSCONF },
195 #endif
196 #ifdef _SC_SCHAR_MIN
197 { "SCHAR_MIN", _SC_SCHAR_MIN, SYSCONF },
198 #endif
199 #ifdef _SC_SHRT_MAX
200 { "SHRT_MAX", _SC_SHRT_MAX, SYSCONF },
201 #endif
202 #ifdef _SC_SHRT_MIN
203 { "SHRT_MIN", _SC_SHRT_MIN, SYSCONF },
204 #endif
205 #ifdef _SC_SSIZE_MAX
206 { "SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
207 #endif
208 #ifdef _SC_TTY_NAME_MAX
209 { "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
210 #endif
211 #ifdef _SC_TZNAME_MAX
212 { "TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
213 #endif
214 #ifdef _SC_UCHAR_MAX
215 { "UCHAR_MAX", _SC_UCHAR_MAX, SYSCONF },
216 #endif
217 #ifdef _SC_UINT_MAX
218 { "UINT_MAX", _SC_UINT_MAX, SYSCONF },
219 #endif
220 #ifdef _SC_UIO_MAXIOV
221 { "UIO_MAXIOV", _SC_UIO_MAXIOV, SYSCONF },
222 #endif
223 #ifdef _SC_ULONG_MAX
224 { "ULONG_MAX", _SC_ULONG_MAX, SYSCONF },
225 #endif
226 #ifdef _SC_USHRT_MAX
227 { "USHRT_MAX", _SC_USHRT_MAX, SYSCONF },
228 #endif
229 #ifdef _SC_WORD_BIT
230 { "WORD_BIT", _SC_WORD_BIT, SYSCONF },
231 #endif
232 #ifdef _SC_AVPHYS_PAGES
233 { "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
234 #endif
235 #ifdef _SC_NPROCESSORS_CONF
236 { "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
237 #endif
238 #ifdef _SC_NPROCESSORS_ONLN
239 { "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
240 #endif
241 #ifdef _SC_PHYS_PAGES
242 { "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
243 #endif
244 #ifdef _SC_ARG_MAX
245 { "_POSIX_ARG_MAX", _SC_ARG_MAX, SYSCONF },
246 #endif
247 #ifdef _SC_ASYNCHRONOUS_IO
248 { "_POSIX_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO, SYSCONF },
249 #endif
250 #ifdef _SC_CHILD_MAX
251 { "_POSIX_CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
252 #endif
253 #ifdef _SC_FSYNC
254 { "_POSIX_FSYNC", _SC_FSYNC, SYSCONF },
255 #endif
256 #ifdef _SC_JOB_CONTROL
257 { "_POSIX_JOB_CONTROL", _SC_JOB_CONTROL, SYSCONF },
258 #endif
259 #ifdef _SC_MAPPED_FILES
260 { "_POSIX_MAPPED_FILES", _SC_MAPPED_FILES, SYSCONF },
261 #endif
262 #ifdef _SC_MEMLOCK
263 { "_POSIX_MEMLOCK", _SC_MEMLOCK, SYSCONF },
264 #endif
265 #ifdef _SC_MEMLOCK_RANGE
266 { "_POSIX_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE, SYSCONF },
267 #endif
268 #ifdef _SC_MEMORY_PROTECTION
269 { "_POSIX_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION, SYSCONF },
270 #endif
271 #ifdef _SC_MESSAGE_PASSING
272 { "_POSIX_MESSAGE_PASSING", _SC_MESSAGE_PASSING, SYSCONF },
273 #endif
274 #ifdef _SC_NGROUPS_MAX
275 { "_POSIX_NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
276 #endif
277 #ifdef _SC_OPEN_MAX
278 { "_POSIX_OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
279 #endif
280 #ifdef _SC_PII
281 { "_POSIX_PII", _SC_PII, SYSCONF },
282 #endif
283 #ifdef _SC_PII_INTERNET
284 { "_POSIX_PII_INTERNET", _SC_PII_INTERNET, SYSCONF },
285 #endif
286 #ifdef _SC_PII_INTERNET_DGRAM
287 { "_POSIX_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM, SYSCONF },
288 #endif
289 #ifdef _SC_PII_INTERNET_STREAM
290 { "_POSIX_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM, SYSCONF },
291 #endif
292 #ifdef _SC_PII_OSI
293 { "_POSIX_PII_OSI", _SC_PII_OSI, SYSCONF },
294 #endif
295 #ifdef _SC_PII_OSI_CLTS
296 { "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
297 #endif
298 #ifdef _SC_PII_OSI_COTS
299 { "_POSIX_PII_OSI_COTS", _SC_PII_OSI_COTS, SYSCONF },
300 #endif
301 #ifdef _SC_PII_OSI_M
302 { "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
303 #endif
304 #ifdef _SC_PII_SOCKET
305 { "_POSIX_PII_SOCKET", _SC_PII_SOCKET, SYSCONF },
306 #endif
307 #ifdef _SC_PII_XTI
308 { "_POSIX_PII_XTI", _SC_PII_XTI, SYSCONF },
309 #endif
310 #ifdef _SC_POLL
311 { "_POSIX_POLL", _SC_POLL, SYSCONF },
312 #endif
313 #ifdef _SC_PRIORITIZED_IO
314 { "_POSIX_PRIORITIZED_IO", _SC_PRIORITIZED_IO, SYSCONF },
315 #endif
316 #ifdef _SC_PRIORITY_SCHEDULING
317 { "_POSIX_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING, SYSCONF },
318 #endif
319 #ifdef _SC_REALTIME_SIGNALS
320 { "_POSIX_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS, SYSCONF },
321 #endif
322 #ifdef _SC_SAVED_IDS
323 { "_POSIX_SAVED_IDS", _SC_SAVED_IDS, SYSCONF },
324 #endif
325 #ifdef _SC_SELECT
326 { "_POSIX_SELECT", _SC_SELECT, SYSCONF },
327 #endif
328 #ifdef _SC_SEMAPHORES
329 { "_POSIX_SEMAPHORES", _SC_SEMAPHORES, SYSCONF },
330 #endif
331 #ifdef _SC_SHARED_MEMORY_OBJECTS
332 { "_POSIX_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS, SYSCONF },
333 #endif
334 #ifdef _SC_SSIZE_MAX
335 { "_POSIX_SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
336 #endif
337 #ifdef _SC_STREAM_MAX
338 { "_POSIX_STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
339 #endif
340 #ifdef _SC_SYNCHRONIZED_IO
341 { "_POSIX_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO, SYSCONF },
342 #endif
343 #ifdef _SC_THREADS
344 { "_POSIX_THREADS", _SC_THREADS, SYSCONF },
345 #endif
346 #ifdef _SC_THREAD_ATTR_STACKADDR
347 { "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
348 #endif
349 #ifdef _SC_THREAD_ATTR_STACKSIZE
350 { "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
351 #endif
352 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
353 { "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
354 #endif
355 #ifdef _SC_THREAD_PRIO_INHERIT
356 { "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
357 #endif
358 #ifdef _SC_THREAD_PRIO_PROTECT
359 { "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
360 #endif
361 #ifdef _SC_THREAD_ROBUST_PRIO_INHERIT
362 { "_POSIX_THREAD_ROBUST_PRIO_INHERIT", _SC_THREAD_ROBUST_PRIO_INHERIT,
363 SYSCONF },
364 #endif
365 #ifdef _SC_THREAD_ROBUST_PRIO_PROTECT
366 { "_POSIX_THREAD_ROBUST_PRIO_PROTECT", _SC_THREAD_ROBUST_PRIO_PROTECT,
367 SYSCONF },
368 #endif
369 #ifdef _SC_THREAD_PROCESS_SHARED
370 { "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
371 #endif
372 #ifdef _SC_THREAD_SAFE_FUNCTIONS
373 { "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
374 #endif
375 #ifdef _SC_TIMERS
376 { "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
377 #endif
378 #ifdef _SC_TIMER_MAX
379 { "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
380 #endif
381 #ifdef _SC_TZNAME_MAX
382 { "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
383 #endif
384 #ifdef _SC_VERSION
385 { "_POSIX_VERSION", _SC_VERSION, SYSCONF },
386 #endif
387 #ifdef _SC_T_IOV_MAX
388 { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
389 #endif
390 #ifdef _SC_XOPEN_CRYPT
391 { "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
392 #endif
393 #ifdef _SC_XOPEN_ENH_I18N
394 { "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
395 #endif
396 #ifdef _SC_XOPEN_LEGACY
397 { "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
398 #endif
399 #ifdef _SC_XOPEN_REALTIME
400 { "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
401 #endif
402 #ifdef _SC_XOPEN_REALTIME_THREADS
403 { "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
404 #endif
405 #ifdef _SC_XOPEN_SHM
406 { "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
407 #endif
408 #ifdef _SC_XOPEN_UNIX
409 { "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
410 #endif
411 #ifdef _SC_XOPEN_VERSION
412 { "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
413 #endif
414 #ifdef _SC_XOPEN_XCU_VERSION
415 { "_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION, SYSCONF },
416 #endif
417 #ifdef _SC_XOPEN_XPG2
418 { "_XOPEN_XPG2", _SC_XOPEN_XPG2, SYSCONF },
419 #endif
420 #ifdef _SC_XOPEN_XPG3
421 { "_XOPEN_XPG3", _SC_XOPEN_XPG3, SYSCONF },
422 #endif
423 #ifdef _SC_XOPEN_XPG4
424 { "_XOPEN_XPG4", _SC_XOPEN_XPG4, SYSCONF },
425 #endif
426 /* POSIX.2 */
427 #ifdef _SC_BC_BASE_MAX
428 { "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
429 #endif
430 #ifdef _SC_BC_DIM_MAX
431 { "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
432 #endif
433 #ifdef _SC_BC_SCALE_MAX
434 { "BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
435 #endif
436 #ifdef _SC_BC_STRING_MAX
437 { "BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
438 #endif
439 { "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
440 #ifdef _SC_COLL_WEIGHTS_MAX
441 { "COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
442 #endif
443 #ifdef _SC_EQUIV_CLASS_MAX
444 { "EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX, SYSCONF },
445 #endif
446 #ifdef _SC_EXPR_NEST_MAX
447 { "EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
448 #endif
449 #ifdef _SC_LINE_MAX
450 { "LINE_MAX", _SC_LINE_MAX, SYSCONF },
451 #endif
452 #ifdef _SC_BC_BASE_MAX
453 { "POSIX2_BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
454 #endif
455 #ifdef _SC_BC_DIM_MAX
456 { "POSIX2_BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
457 #endif
458 #ifdef _SC_BC_SCALE_MAX
459 { "POSIX2_BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
460 #endif
461 #ifdef _SC_BC_STRING_MAX
462 { "POSIX2_BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
463 #endif
464 #ifdef _SC_2_CHAR_TERM
465 { "POSIX2_CHAR_TERM", _SC_2_CHAR_TERM, SYSCONF },
466 #endif
467 #ifdef _SC_COLL_WEIGHTS_MAX
468 { "POSIX2_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
469 #endif
470 #ifdef _SC_2_C_BIND
471 { "POSIX2_C_BIND", _SC_2_C_BIND, SYSCONF },
472 #endif
473 #ifdef _SC_2_C_DEV
474 { "POSIX2_C_DEV", _SC_2_C_DEV, SYSCONF },
475 #endif
476 #ifdef _SC_2_C_VERSION
477 { "POSIX2_C_VERSION", _SC_2_C_VERSION, SYSCONF },
478 #endif
479 #ifdef _SC_EXPR_NEST_MAX
480 { "POSIX2_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
481 #endif
482 #ifdef _SC_2_FORT_DEV
483 { "POSIX2_FORT_DEV", _SC_2_FORT_DEV, SYSCONF },
484 #endif
485 #ifdef _SC_2_FORT_RUN
486 { "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
487 #endif
488 #ifdef _SC_LINE_MAX
489 { "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
490 { "POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
491 #endif
492 #ifdef _SC_2_LOCALEDEF
493 { "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
494 #endif
495 #ifdef _SC_RE_DUP_MAX
496 { "POSIX2_RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
497 #endif
498 #ifdef _SC_2_SW_DEV
499 { "POSIX2_SW_DEV", _SC_2_SW_DEV, SYSCONF },
500 #endif
501 #ifdef _SC_2_UPE
502 { "POSIX2_UPE", _SC_2_UPE, SYSCONF },
503 #endif
504 #ifdef _SC_2_VERSION
505 { "POSIX2_VERSION", _SC_2_VERSION, SYSCONF },
506 #endif
507 #ifdef _SC_RE_DUP_MAX
508 { "RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
509 #endif
511 #ifdef _CS_PATH
512 { "PATH", _CS_PATH, CONFSTR },
513 { "CS_PATH", _CS_PATH, CONFSTR },
514 #endif
516 /* LFS */
517 #ifdef _CS_LFS_CFLAGS
518 { "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
519 #endif
520 #ifdef _CS_LFS_LDFLAGS
521 { "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
522 #endif
523 #ifdef _CS_LFS_LIBS
524 { "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
525 #endif
526 #ifdef _CS_LFS_LINTFLAGS
527 { "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
528 #endif
529 #ifdef _CS_LFS64_CFLAGS
530 { "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
531 #endif
532 #ifdef _CS_LFS64_LDFLAGS
533 { "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
534 #endif
535 #ifdef _CS_LFS64_LIBS
536 { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
537 #endif
538 #ifdef _CS_LFS64_LINTFLAGS
539 { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
540 #endif
542 /* Programming environments. */
543 #ifdef _CS_V5_WIDTH_RESTRICTED_ENVS
544 { "_XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
545 { "XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
546 #endif
548 #ifdef _SC_XBS5_ILP32_OFF32
549 { "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
550 #endif
551 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
552 { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
553 #endif
554 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
555 { "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
556 #endif
557 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
558 { "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
559 #endif
560 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
561 { "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
562 #endif
564 #ifdef _SC_XBS5_ILP32_OFFBIG
565 { "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
566 #endif
567 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
568 { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
569 #endif
570 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
571 { "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
572 #endif
573 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
574 { "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
575 #endif
576 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
577 { "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
578 #endif
580 #ifdef _SC_XBS5_LP64_OFF64
581 { "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
582 #endif
583 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
584 { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
585 #endif
586 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
587 { "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
588 #endif
589 #ifdef _CS_XBS5_LP64_OFF64_LIBS
590 { "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
591 #endif
592 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
593 { "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
594 #endif
596 #ifdef _SC_XBS5_LPBIG_OFFBIG
597 { "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
598 #endif
599 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
600 { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
601 #endif
602 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
603 { "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
604 #endif
605 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
606 { "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
607 #endif
608 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
609 { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
610 #endif
612 #ifdef _SC_V6_ILP32_OFF32
613 { "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
614 #endif
615 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
616 { "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
617 #endif
618 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
619 { "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
620 #endif
621 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
622 { "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
623 #endif
624 #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
625 { "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
626 #endif
628 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
629 { "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
630 { "POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
631 #endif
633 #ifdef _SC_V6_ILP32_OFFBIG
634 { "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
635 #endif
636 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
637 { "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
638 #endif
639 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
640 { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
641 #endif
642 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
643 { "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
644 #endif
645 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
646 { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
647 #endif
649 #ifdef _SC_V6_LP64_OFF64
650 { "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
651 #endif
652 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
653 { "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
654 #endif
655 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
656 { "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
657 #endif
658 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
659 { "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
660 #endif
661 #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
662 { "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
663 #endif
665 #ifdef _SC_V6_LPBIG_OFFBIG
666 { "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
667 #endif
668 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
669 { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
670 #endif
671 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
672 { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
673 #endif
674 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
675 { "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
676 #endif
677 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
678 { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
679 #endif
681 #ifdef _SC_V7_ILP32_OFF32
682 { "_POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32, SYSCONF },
683 #endif
684 #ifdef _CS_POSIX_V7_ILP32_OFF32_CFLAGS
685 { "POSIX_V7_ILP32_OFF32_CFLAGS", _CS_POSIX_V7_ILP32_OFF32_CFLAGS, CONFSTR },
686 #endif
687 #ifdef _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
688 { "POSIX_V7_ILP32_OFF32_LDFLAGS", _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, CONFSTR },
689 #endif
690 #ifdef _CS_POSIX_V7_ILP32_OFF32_LIBS
691 { "POSIX_V7_ILP32_OFF32_LIBS", _CS_POSIX_V7_ILP32_OFF32_LIBS, CONFSTR },
692 #endif
693 #ifdef _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
694 { "POSIX_V7_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, CONFSTR },
695 #endif
697 #ifdef _CS_V7_WIDTH_RESTRICTED_ENVS
698 { "_POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
699 { "POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
700 #endif
702 #ifdef _SC_V7_ILP32_OFFBIG
703 { "_POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG, SYSCONF },
704 #endif
705 #ifdef _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
706 { "POSIX_V7_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, CONFSTR },
707 #endif
708 #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
709 { "POSIX_V7_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, CONFSTR },
710 #endif
711 #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LIBS
712 { "POSIX_V7_ILP32_OFFBIG_LIBS", _CS_POSIX_V7_ILP32_OFFBIG_LIBS, CONFSTR },
713 #endif
714 #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
715 { "POSIX_V7_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
716 #endif
718 #ifdef _SC_V7_LP64_OFF64
719 { "_POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64, SYSCONF },
720 #endif
721 #ifdef _CS_POSIX_V7_LP64_OFF64_CFLAGS
722 { "POSIX_V7_LP64_OFF64_CFLAGS", _CS_POSIX_V7_LP64_OFF64_CFLAGS, CONFSTR },
723 #endif
724 #ifdef _CS_POSIX_V7_LP64_OFF64_LDFLAGS
725 { "POSIX_V7_LP64_OFF64_LDFLAGS", _CS_POSIX_V7_LP64_OFF64_LDFLAGS, CONFSTR },
726 #endif
727 #ifdef _CS_POSIX_V7_LP64_OFF64_LIBS
728 { "POSIX_V7_LP64_OFF64_LIBS", _CS_POSIX_V7_LP64_OFF64_LIBS, CONFSTR },
729 #endif
730 #ifdef _CS_POSIX_V7_LP64_OFF64_LINTFLAGS
731 { "POSIX_V7_LP64_OFF64_LINTFLAGS", _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, CONFSTR },
732 #endif
734 #ifdef _SC_V7_LPBIG_OFFBIG
735 { "_POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG, SYSCONF },
736 #endif
737 #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
738 { "POSIX_V7_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, CONFSTR },
739 #endif
740 #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
741 { "POSIX_V7_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
742 #endif
743 #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
744 { "POSIX_V7_LPBIG_OFFBIG_LIBS", _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, CONFSTR },
745 #endif
746 #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
747 { "POSIX_V7_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
748 #endif
750 #ifdef _SC_ADVISORY_INFO
751 { "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
752 #endif
753 #ifdef _SC_BARRIERS
754 { "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
755 #endif
756 #ifdef _SC_BASE
757 { "_POSIX_BASE", _SC_BASE, SYSCONF },
758 #endif
759 #ifdef _SC_C_LANG_SUPPORT
760 { "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
761 #endif
762 #ifdef _SC_C_LANG_SUPPORT_R
763 { "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
764 #endif
765 #ifdef _SC_CLOCK_SELECTION
766 { "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
767 #endif
768 #ifdef _SC_CPUTIME
769 { "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
770 #endif
771 #ifdef _SC_THREAD_CPUTIME
772 { "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
773 #endif
774 #ifdef _SC_DEVICE_SPECIFIC
775 { "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
776 #endif
777 #ifdef _SC_DEVICE_SPECIFIC_R
778 { "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
779 #endif
780 #ifdef _SC_FD_MGMT
781 { "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
782 #endif
783 #ifdef _SC_FIFO
784 { "_POSIX_FIFO", _SC_FIFO, SYSCONF },
785 #endif
786 #ifdef _SC_PIPE
787 { "_POSIX_PIPE", _SC_PIPE, SYSCONF },
788 #endif
789 #ifdef _SC_FILE_ATTRIBUTES
790 { "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
791 #endif
792 #ifdef _SC_FILE_LOCKING
793 { "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
794 #endif
795 #ifdef _SC_FILE_SYSTEM
796 { "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
797 #endif
798 #ifdef _SC_MONOTONIC_CLOCK
799 { "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
800 #endif
801 #ifdef _SC_MULTI_PROCESS
802 { "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
803 #endif
804 #ifdef _SC_SINGLE_PROCESS
805 { "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
806 #endif
807 #ifdef _SC_NETWORKING
808 { "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
809 #endif
810 #ifdef _SC_READER_WRITER_LOCKS
811 { "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
812 #endif
813 #ifdef _SC_SPIN_LOCKS
814 { "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
815 #endif
816 #ifdef _SC_REGEXP
817 { "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
818 #endif
819 #ifdef _SC_REGEX_VERSION
820 { "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
821 #endif
822 #ifdef _SC_SHELL
823 { "_POSIX_SHELL", _SC_SHELL, SYSCONF },
824 #endif
825 #ifdef _SC_SIGNALS
826 { "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
827 #endif
828 #ifdef _SC_SPAWN
829 { "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
830 #endif
831 #ifdef _SC_SPORADIC_SERVER
832 { "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
833 #endif
834 #ifdef _SC_THREAD_SPORADIC_SERVER
835 { "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
836 #endif
837 #ifdef _SC_SYSTEM_DATABASE
838 { "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
839 #endif
840 #ifdef _SC_SYSTEM_DATABASE_R
841 { "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
842 #endif
843 #ifdef _SC_TIMEOUTS
844 { "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
845 #endif
846 #ifdef _SC_TYPED_MEMORY_OBJECTS
847 { "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
848 #endif
849 #ifdef _SC_USER_GROUPS
850 { "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
851 #endif
852 #ifdef _SC_USER_GROUPS_R
853 { "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
854 #endif
855 #ifdef _SC_2_PBS
856 { "POSIX2_PBS", _SC_2_PBS, SYSCONF },
857 #endif
858 #ifdef _SC_2_PBS_ACCOUNTING
859 { "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
860 #endif
861 #ifdef _SC_2_PBS_LOCATE
862 { "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
863 #endif
864 #ifdef _SC_2_PBS_TRACK
865 { "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
866 #endif
867 #ifdef _SC_2_PBS_MESSAGE
868 { "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
869 #endif
870 #ifdef _SC_SYMLOOP_MAX
871 { "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
872 #endif
873 #ifdef _SC_STREAM_MAX
874 { "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
875 #endif
876 #ifdef _SC_AIO_LISTIO_MAX
877 { "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
878 #endif
879 #ifdef _SC_AIO_MAX
880 { "AIO_MAX", _SC_AIO_MAX, SYSCONF },
881 #endif
882 #ifdef _SC_AIO_PRIO_DELTA_MAX
883 { "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
884 #endif
885 #ifdef _SC_DELAYTIMER_MAX
886 { "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
887 #endif
888 #ifdef _SC_HOST_NAME_MAX
889 { "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
890 #endif
891 #ifdef _SC_LOGIN_NAME_MAX
892 { "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
893 #endif
894 #ifdef _SC_MQ_OPEN_MAX
895 { "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
896 #endif
897 #ifdef _SC_MQ_PRIO_MAX
898 { "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
899 #endif
900 #ifdef _SC_DEVICE_IO
901 { "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
902 #endif
903 #ifdef _SC_TRACE
904 { "_POSIX_TRACE", _SC_TRACE, SYSCONF },
905 #endif
906 #ifdef _SC_TRACE_EVENT_FILTER
907 { "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
908 #endif
909 #ifdef _SC_TRACE_INHERIT
910 { "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
911 #endif
912 #ifdef _SC_TRACE_LOG
913 { "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
914 #endif
915 #ifdef _SC_RTSIG_MAX
916 { "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
917 #endif
918 #ifdef _SC_SEM_NSEMS_MAX
919 { "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
920 #endif
921 #ifdef _SC_SEM_VALUE_MAX
922 { "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
923 #endif
924 #ifdef _SC_SIGQUEUE_MAX
925 { "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
926 #endif
927 #ifdef _PC_FILESIZEBITS
928 { "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
929 #endif
930 #ifdef _PC_ALLOC_SIZE_MIN
931 { "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
932 #endif
933 #ifdef _PC_REC_INCR_XFER_SIZE
934 { "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
935 #endif
936 #ifdef _PC_REC_MAX_XFER_SIZE
937 { "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
938 #endif
939 #ifdef _PC_REC_MIN_XFER_SIZE
940 { "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
941 #endif
942 #ifdef _PC_REC_XFER_ALIGN
943 { "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
944 #endif
945 #ifdef _PC_SYMLINK_MAX
946 { "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
947 #endif
948 #ifdef _CS_GNU_LIBC_VERSION
949 { "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
950 #endif
951 #ifdef _CS_GNU_LIBPTHREAD_VERSION
952 { "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
953 #endif
954 #ifdef _PC_2_SYMLINKS
955 { "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
956 #endif
958 #ifdef _SC_LEVEL1_ICACHE_SIZE
959 { "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
960 #endif
961 #ifdef _SC_LEVEL1_ICACHE_ASSOC
962 { "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
963 #endif
964 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
965 { "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
966 #endif
967 #ifdef _SC_LEVEL1_DCACHE_SIZE
968 { "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
969 #endif
970 #ifdef _SC_LEVEL1_DCACHE_ASSOC
971 { "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
972 #endif
973 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
974 { "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
975 #endif
976 #ifdef _SC_LEVEL2_CACHE_SIZE
977 { "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
978 #endif
979 #ifdef _SC_LEVEL2_CACHE_ASSOC
980 { "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
981 #endif
982 #ifdef _SC_LEVEL2_CACHE_LINESIZE
983 { "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
984 #endif
985 #ifdef _SC_LEVEL3_CACHE_SIZE
986 { "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
987 #endif
988 #ifdef _SC_LEVEL3_CACHE_ASSOC
989 { "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
990 #endif
991 #ifdef _SC_LEVEL3_CACHE_LINESIZE
992 { "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
993 #endif
994 #ifdef _SC_LEVEL4_CACHE_SIZE
995 { "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
996 #endif
997 #ifdef _SC_LEVEL4_CACHE_ASSOC
998 { "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
999 #endif
1000 #ifdef _SC_LEVEL4_CACHE_LINESIZE
1001 { "LEVEL4_CACHE_LINESIZE", _SC_LEVEL4_CACHE_LINESIZE, SYSCONF },
1002 #endif
1004 #ifdef _SC_IPV6
1005 { "IPV6", _SC_IPV6, SYSCONF },
1006 #endif
1007 #ifdef _SC_RAW_SOCKETS
1008 { "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
1009 #endif
1011 { NULL, 0, SYSCONF }
1015 static const struct { const char *name; int num; } specs[] =
1017 #ifdef _SC_XBS5_ILP32_OFF32
1018 { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32 },
1019 #endif
1020 #ifdef _SC_XBS5_ILP32_OFFBIG
1021 { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG },
1022 #endif
1023 #ifdef _SC_XBS5_LP64_OFF64
1024 { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64 },
1025 #endif
1026 #ifdef _SC_XBS5_LPBIG_OFFBIG
1027 { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG },
1028 #endif
1029 #ifdef _SC_V6_ILP32_OFF32
1030 { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
1031 #endif
1032 #ifdef _SC_V6_ILP32_OFFBIG
1033 { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
1034 #endif
1035 #ifdef _SC_V6_LP64_OFF64
1036 { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
1037 #endif
1038 #ifdef _SC_V6_LPBIG_OFFBIG
1039 { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG },
1040 #endif
1041 #ifdef _SC_V7_ILP32_OFF32
1042 { "POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32 },
1043 #endif
1044 #ifdef _SC_V7_ILP32_OFFBIG
1045 { "POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG },
1046 #endif
1047 #ifdef _SC_V7_LP64_OFF64
1048 { "POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64 },
1049 #endif
1050 #ifdef _SC_V7_LPBIG_OFFBIG
1051 { "POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG },
1052 #endif
1054 static const int nspecs = sizeof (specs) / sizeof (specs[0]);
1056 #ifndef __UCLIBC_HAS___PROGNAME__
1057 static const char *__progname = "getconf";
1058 #endif
1060 static attribute_noreturn void
1061 usage (void)
1063 fprintf (stderr,
1064 _("Usage: %s [-v specification] variable_name [pathname]\n"),
1065 __progname);
1066 fprintf (stderr,
1067 _(" %s -a [pathname]\n"), __progname);
1068 exit (2);
1072 static attribute_noreturn void
1073 print_all (const char *path)
1075 register const struct conf *c;
1076 size_t clen;
1077 long int value;
1078 char *cvalue;
1079 for (c = vars; c->name != NULL; ++c) {
1080 printf("%-35s", c->name);
1081 switch (c->call) {
1082 case PATHCONF:
1083 value = pathconf (path, c->call_name);
1084 if (value != -1) {
1085 printf("%ld", value);
1087 printf("\n");
1088 break;
1089 case SYSCONF:
1090 value = sysconf (c->call_name);
1091 if (value == -1l) {
1092 if (c->call_name == _SC_UINT_MAX
1093 || c->call_name == _SC_ULONG_MAX)
1094 printf ("%lu", value);
1096 else {
1097 printf ("%ld", value);
1099 printf ("\n");
1100 break;
1101 case CONFSTR:
1102 clen = confstr (c->call_name, (char *) NULL, 0);
1103 cvalue = (char *) malloc (clen);
1104 if (cvalue == NULL)
1105 error (3, 0, _("memory exhausted"));
1106 if (confstr (c->call_name, cvalue, clen) != clen)
1107 error (3, errno, "confstr");
1108 printf ("%.*s\n", (int) clen, cvalue);
1109 free (cvalue);
1110 break;
1113 exit (0);
1117 main (int argc, char *argv[])
1119 register const struct conf *c;
1121 /* Set locale. Do not set LC_ALL because the other categories must
1122 not be affected (according to POSIX.2). */
1124 /* Initialize the message catalog. */
1126 if (argc > 1 && strcmp (argv[1], "--version") == 0)
1128 printf ("getconf (GNU %s) %s\n", PACKAGE, VERSION);
1129 printf ("\
1130 Copyright (C) %s Free Software Foundation, Inc.\n\
1131 This is free software; see the source for copying conditions. There is NO\n\
1132 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
1133 ", "2009");
1134 printf ("Written by %s.\n", "Roland McGrath");
1135 return 0;
1138 if (argc > 1 && strcmp (argv[1], "--help") == 0)
1140 printf ("\
1141 Usage: getconf [-v SPEC] VAR\n\
1142 or: getconf [-v SPEC] PATH_VAR PATH\n\
1144 Get the configuration value for variable VAR, or for variable PATH_VAR\n\
1145 for path PATH. If SPEC is given, give values for compilation\n\
1146 environment SPEC.\n\n");
1147 fputs ("For bug reporting instructions, please see:\n\
1148 <http://www.gnu.org/software/libc/bugs.html>.\n", stdout);
1149 return 0;
1152 const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
1153 size_t getconf_dirlen = strlen (getconf_dir);
1155 const char *spec = NULL;
1156 char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
1157 char *argv0 = argv[0];
1158 if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
1160 if (argv[1][2] == '\0')
1162 if (argc < 3)
1163 usage ();
1165 spec = argv[2];
1166 argv += 2;
1167 argc -= 2;
1169 else
1171 spec = &argv[1][2];
1172 argv += 1;
1173 argc += 1;
1176 else
1178 char default_name[getconf_dirlen + sizeof "/default"];
1179 memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
1180 "/default", sizeof "/default");
1181 int len = readlink (default_name, buf, sizeof buf - 1);
1182 if (len > 0)
1184 buf[len] = '\0';
1185 spec = buf;
1189 /* Check for the specifications we know. */
1190 if (spec != NULL)
1192 int i;
1193 for (i = 0; i < nspecs; ++i)
1194 if (strcmp (spec, specs[i].name) == 0)
1195 break;
1197 if (i == nspecs)
1198 error (2, 0, _("unknown specification \"%s\""), spec);
1200 switch (specs[i].num)
1202 #if !defined(_XBS5_ILP32_OFF32) && defined(_SC_XBS5_ILP32_OFF32)
1203 case _SC_XBS5_ILP32_OFF32:
1204 #endif
1205 #if !defined(_XBS5_ILP32_OFFBIG) && defined(_SC_XBS5_ILP32_OFFBIG)
1206 case _SC_XBS5_ILP32_OFFBIG:
1207 #endif
1208 #if !defined(_XBS5_LP64_OFF64) && defined(_SC_XBS5_LP64_OFF64)
1209 case _SC_XBS5_LP64_OFF64:
1210 #endif
1211 #if !defined(_XBS5_LPBIG_OFFBIG) && defined(_SC_XBS5_LPBIG_OFFBIG)
1212 case _SC_XBS5_LPBIG_OFFBIG:
1213 #endif
1214 #if !defined(_POSIX_V6_ILP32_OFF32) && defined(_SC_V6_ILP32_OFF32)
1215 case _SC_V6_ILP32_OFF32:
1216 #endif
1217 #if !defined(_POSIX_V6_ILP32_OFFBIG) && defined(_SC_V6_ILP32_OFFBIG)
1218 case _SC_V6_ILP32_OFFBIG:
1219 #endif
1220 #if !defined(_POSIX_V6_LP64_OFF64) && defined(_SC_V6_LP64_OFF64)
1221 case _SC_V6_LP64_OFF64:
1222 #endif
1223 #if !defined(_POSIX_V6_LPBIG_OFFBIG) && defined(_SC_V6_LPBIG_OFFBIG)
1224 case _SC_V6_LPBIG_OFFBIG:
1225 #endif
1226 #if !defined(_POSIX_V7_ILP32_OFF32) && defined(_SC_V7_ILP32_OFF32)
1227 case _SC_V7_ILP32_OFF32:
1228 #endif
1229 #if !defined(_POSIX_V7_ILP32_OFFBIG) && defined(_SC_V7_ILP32_OFFBIG)
1230 case _SC_V7_ILP32_OFFBIG:
1231 #endif
1232 #if !defined(_POSIX_V7_LP64_OFF64) && defined(_SC_V7_LP64_OFF64)
1233 case _SC_V7_LP64_OFF64:
1234 #endif
1235 #if !defined(_POSIX_V7_LPBIG_OFFBIG) && defined(_SC_V7_LPBIG_OFFBIG)
1236 case _SC_V7_LPBIG_OFFBIG:
1237 #endif
1239 const char *args[argc + 3];
1240 size_t spec_len = strlen (spec);
1241 char getconf_name[getconf_dirlen + 1 + spec_len + 1];
1242 memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
1243 getconf_dirlen),
1244 "/", 1), spec, spec_len + 1);
1245 args[0] = argv0;
1246 args[1] = "-v";
1247 args[2] = spec;
1248 memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
1249 execv (getconf_name, (char * const *) args);
1250 error (4, errno, _("Couldn't execute %s"), getconf_name);
1252 default:
1253 break;
1257 if (argc > 1 && strcmp (argv[1], "-a") == 0)
1259 if (argc == 2)
1260 print_all ("/");
1261 else if (argc == 3)
1262 print_all (argv[2]);
1263 else
1264 usage ();
1267 int ai = 1;
1268 if (argc > ai && strcmp (argv[ai], "--") == 0)
1269 ++ai;
1271 if (argc - ai < 1 || argc - ai > 2)
1272 usage ();
1274 for (c = vars; c->name != NULL; ++c)
1275 if (strcmp (c->name, argv[ai]) == 0
1276 || (strncmp (c->name, "_POSIX_", 7) == 0
1277 && strcmp (c->name + 7, argv[ai]) == 0))
1279 long int value;
1280 size_t clen;
1281 char *cvalue;
1282 switch (c->call)
1284 case PATHCONF:
1285 if (argc - ai < 2)
1286 usage ();
1287 errno = 0;
1288 value = pathconf (argv[ai + 1], c->call_name);
1289 if (value == -1)
1291 if (errno) {
1292 error (3, errno, "pathconf: %s", argv[ai + 1]);
1293 } else
1294 puts (_("undefined"));
1296 else
1297 printf ("%ld\n", value);
1298 exit (0);
1300 case SYSCONF:
1301 if (argc - ai > 1)
1302 usage ();
1303 value = sysconf (c->call_name);
1304 if (value == -1l)
1306 if (c->call_name == _SC_UINT_MAX
1307 || c->call_name == _SC_ULONG_MAX)
1308 printf ("%lu\n", value);
1309 else
1310 puts (_("undefined"));
1312 else
1313 printf ("%ld\n", value);
1314 exit (0);
1316 case CONFSTR:
1317 if (argc - ai > 1)
1318 usage ();
1319 clen = confstr (c->call_name, (char *) NULL, 0);
1320 cvalue = (char *) malloc (clen);
1321 if (cvalue == NULL)
1322 error (3, 0, _("memory exhausted"));
1324 if (confstr (c->call_name, cvalue, clen) != clen)
1325 error (3, errno, "confstr");
1327 printf ("%.*s\n", (int) clen, cvalue);
1328 exit (0);
1332 error (2, 0, _("Unrecognized variable `%s'"), argv[ai]);
1333 /* NOTREACHED */
1334 return 2;