* sysdeps/unix/sysv/linux/bits/resource.h: Define RUSAGE_THREAD and
[glibc.git] / posix / getconf.c
blob61842922022f0f2a6a083e7344a7b170a7b35c1a
1 /* Copyright (C) 1991, 92, 1995-2007, 2008 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, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 #include <unistd.h>
19 #include <errno.h>
20 #include <error.h>
21 #include <libintl.h>
22 #include <locale.h>
23 #include <string.h>
24 #include <stdlib.h>
25 #include <stdio.h>
27 #include "../version.h"
28 #define PACKAGE _libc_intl_domainname
30 struct conf
32 const char *name;
33 const int call_name;
34 const enum { SYSCONF, CONFSTR, PATHCONF } call;
37 static const struct conf vars[] =
39 #ifdef _PC_LINK_MAX
40 { "LINK_MAX", _PC_LINK_MAX, PATHCONF },
41 #endif
42 #ifdef _PC_LINK_MAX
43 { "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
44 #endif
45 #ifdef _PC_MAX_CANON
46 { "MAX_CANON", _PC_MAX_CANON, PATHCONF },
47 #endif
48 #ifdef _PC_MAX_CANON
49 { "_POSIX_MAX_CANON", _PC_MAX_CANON, PATHCONF },
50 #endif
51 #ifdef _PC_MAX_INPUT
52 { "MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
53 #endif
54 #ifdef _PC_MAX_INPUT
55 { "_POSIX_MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
56 #endif
57 #ifdef _PC_NAME_MAX
58 { "NAME_MAX", _PC_NAME_MAX, PATHCONF },
59 #endif
60 #ifdef _PC_NAME_MAX
61 { "_POSIX_NAME_MAX", _PC_NAME_MAX, PATHCONF },
62 #endif
63 #ifdef _PC_PATH_MAX
64 { "PATH_MAX", _PC_PATH_MAX, PATHCONF },
65 #endif
66 #ifdef _PC_PATH_MAX
67 { "_POSIX_PATH_MAX", _PC_PATH_MAX, PATHCONF },
68 #endif
69 #ifdef _PC_PIPE_BUF
70 { "PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
71 #endif
72 #ifdef _PC_PIPE_BUF
73 { "_POSIX_PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
74 #endif
75 #ifdef _PC_SOCK_MAXBUF
76 { "SOCK_MAXBUF", _PC_SOCK_MAXBUF, PATHCONF },
77 #endif
78 #ifdef _PC_ASYNC_IO
79 { "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF },
80 #endif
81 #ifdef _PC_CHOWN_RESTRICTED
82 { "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF },
83 #endif
84 #ifdef _PC_NO_TRUNC
85 { "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF },
86 #endif
87 #ifdef _PC_PRIO_IO
88 { "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF },
89 #endif
90 #ifdef _PC_SYNC_IO
91 { "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF },
92 #endif
93 #ifdef _PC_VDISABLE
94 { "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF },
95 #endif
97 #ifdef _SC_ARG_MAX
98 { "ARG_MAX", _SC_ARG_MAX, SYSCONF },
99 #endif
100 #ifdef _SC_ATEXIT_MAX
101 { "ATEXIT_MAX", _SC_ATEXIT_MAX, SYSCONF },
102 #endif
103 #ifdef _SC_CHAR_BIT
104 { "CHAR_BIT", _SC_CHAR_BIT, SYSCONF },
105 #endif
106 #ifdef _SC_CHAR_MAX
107 { "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
108 #endif
109 #ifdef _SC_CHAR_MIN
110 { "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
111 #endif
112 #ifdef _SC_CHILD_MAX
113 { "CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
114 #endif
115 #ifdef _SC_CLK_TCK
116 { "CLK_TCK", _SC_CLK_TCK, SYSCONF },
117 #endif
118 #ifdef _SC_INT_MAX
119 { "INT_MAX", _SC_INT_MAX, SYSCONF },
120 #endif
121 #ifdef _SC_INT_MIN
122 { "INT_MIN", _SC_INT_MIN, SYSCONF },
123 #endif
124 #ifdef _SC_UIO_MAXIOV
125 { "IOV_MAX", _SC_UIO_MAXIOV, SYSCONF },
126 #endif
127 #ifdef _SC_LOGIN_NAME_MAX
128 { "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
129 #endif
130 #ifdef _SC_LONG_BIT
131 { "LONG_BIT", _SC_LONG_BIT, SYSCONF },
132 #endif
133 #ifdef _SC_MB_LEN_MAX
134 { "MB_LEN_MAX", _SC_MB_LEN_MAX, SYSCONF },
135 #endif
136 #ifdef _SC_NGROUPS_MAX
137 { "NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
138 #endif
139 #ifdef _SC_NL_ARGMAX
140 { "NL_ARGMAX", _SC_NL_ARGMAX, SYSCONF },
141 #endif
142 #ifdef _SC_NL_LANGMAX
143 { "NL_LANGMAX", _SC_NL_LANGMAX, SYSCONF },
144 #endif
145 #ifdef _SC_NL_MSGMAX
146 { "NL_MSGMAX", _SC_NL_MSGMAX, SYSCONF },
147 #endif
148 #ifdef _SC_NL_NMAX
149 { "NL_NMAX", _SC_NL_NMAX, SYSCONF },
150 #endif
151 #ifdef _SC_NL_SETMAX
152 { "NL_SETMAX", _SC_NL_SETMAX, SYSCONF },
153 #endif
154 #ifdef _SC_NL_TEXTMAX
155 { "NL_TEXTMAX", _SC_NL_TEXTMAX, SYSCONF },
156 #endif
157 #ifdef _SC_GETGR_R_SIZE_MAX
158 { "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
159 #endif
160 #ifdef _SC_GETPW_R_SIZE_MAX
161 { "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
162 #endif
163 #ifdef _SC_NZERO
164 { "NZERO", _SC_NZERO, SYSCONF },
165 #endif
166 #ifdef _SC_OPEN_MAX
167 { "OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
168 #endif
169 #ifdef _SC_PAGESIZE
170 { "PAGESIZE", _SC_PAGESIZE, SYSCONF },
171 #endif
172 #ifdef _SC_PAGESIZE
173 { "PAGE_SIZE", _SC_PAGESIZE, SYSCONF },
174 #endif
175 #ifdef _SC_PASS_MAX
176 { "PASS_MAX", _SC_PASS_MAX, SYSCONF },
177 #endif
178 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
179 { "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
180 #endif
181 #ifdef _SC_THREAD_KEYS_MAX
182 { "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
183 #endif
184 #ifdef _SC_THREAD_STACK_MIN
185 { "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
186 #endif
187 #ifdef _SC_THREAD_THREADS_MAX
188 { "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
189 #endif
190 #ifdef _SC_SCHAR_MAX
191 { "SCHAR_MAX", _SC_SCHAR_MAX, SYSCONF },
192 #endif
193 #ifdef _SC_SCHAR_MIN
194 { "SCHAR_MIN", _SC_SCHAR_MIN, SYSCONF },
195 #endif
196 #ifdef _SC_SHRT_MAX
197 { "SHRT_MAX", _SC_SHRT_MAX, SYSCONF },
198 #endif
199 #ifdef _SC_SHRT_MIN
200 { "SHRT_MIN", _SC_SHRT_MIN, SYSCONF },
201 #endif
202 #ifdef _SC_SSIZE_MAX
203 { "SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
204 #endif
205 #ifdef _SC_TTY_NAME_MAX
206 { "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
207 #endif
208 #ifdef _SC_TZNAME_MAX
209 { "TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
210 #endif
211 #ifdef _SC_UCHAR_MAX
212 { "UCHAR_MAX", _SC_UCHAR_MAX, SYSCONF },
213 #endif
214 #ifdef _SC_UINT_MAX
215 { "UINT_MAX", _SC_UINT_MAX, SYSCONF },
216 #endif
217 #ifdef _SC_UIO_MAXIOV
218 { "UIO_MAXIOV", _SC_UIO_MAXIOV, SYSCONF },
219 #endif
220 #ifdef _SC_ULONG_MAX
221 { "ULONG_MAX", _SC_ULONG_MAX, SYSCONF },
222 #endif
223 #ifdef _SC_USHRT_MAX
224 { "USHRT_MAX", _SC_USHRT_MAX, SYSCONF },
225 #endif
226 #ifdef _SC_WORD_BIT
227 { "WORD_BIT", _SC_WORD_BIT, SYSCONF },
228 #endif
229 #ifdef _SC_AVPHYS_PAGES
230 { "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
231 #endif
232 #ifdef _SC_NPROCESSORS_CONF
233 { "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
234 #endif
235 #ifdef _SC_NPROCESSORS_ONLN
236 { "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
237 #endif
238 #ifdef _SC_PHYS_PAGES
239 { "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
240 #endif
241 #ifdef _SC_ARG_MAX
242 { "_POSIX_ARG_MAX", _SC_ARG_MAX, SYSCONF },
243 #endif
244 #ifdef _SC_ASYNCHRONOUS_IO
245 { "_POSIX_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO, SYSCONF },
246 #endif
247 #ifdef _SC_CHILD_MAX
248 { "_POSIX_CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
249 #endif
250 #ifdef _SC_FSYNC
251 { "_POSIX_FSYNC", _SC_FSYNC, SYSCONF },
252 #endif
253 #ifdef _SC_JOB_CONTROL
254 { "_POSIX_JOB_CONTROL", _SC_JOB_CONTROL, SYSCONF },
255 #endif
256 #ifdef _SC_MAPPED_FILES
257 { "_POSIX_MAPPED_FILES", _SC_MAPPED_FILES, SYSCONF },
258 #endif
259 #ifdef _SC_MEMLOCK
260 { "_POSIX_MEMLOCK", _SC_MEMLOCK, SYSCONF },
261 #endif
262 #ifdef _SC_MEMLOCK_RANGE
263 { "_POSIX_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE, SYSCONF },
264 #endif
265 #ifdef _SC_MEMORY_PROTECTION
266 { "_POSIX_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION, SYSCONF },
267 #endif
268 #ifdef _SC_MESSAGE_PASSING
269 { "_POSIX_MESSAGE_PASSING", _SC_MESSAGE_PASSING, SYSCONF },
270 #endif
271 #ifdef _SC_NGROUPS_MAX
272 { "_POSIX_NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
273 #endif
274 #ifdef _SC_OPEN_MAX
275 { "_POSIX_OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
276 #endif
277 #ifdef _SC_PII
278 { "_POSIX_PII", _SC_PII, SYSCONF },
279 #endif
280 #ifdef _SC_PII_INTERNET
281 { "_POSIX_PII_INTERNET", _SC_PII_INTERNET, SYSCONF },
282 #endif
283 #ifdef _SC_PII_INTERNET_DGRAM
284 { "_POSIX_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM, SYSCONF },
285 #endif
286 #ifdef _SC_PII_INTERNET_STREAM
287 { "_POSIX_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM, SYSCONF },
288 #endif
289 #ifdef _SC_PII_OSI
290 { "_POSIX_PII_OSI", _SC_PII_OSI, SYSCONF },
291 #endif
292 #ifdef _SC_PII_OSI_CLTS
293 { "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
294 #endif
295 #ifdef _SC_PII_OSI_COTS
296 { "_POSIX_PII_OSI_COTS", _SC_PII_OSI_COTS, SYSCONF },
297 #endif
298 #ifdef _SC_PII_OSI_M
299 { "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
300 #endif
301 #ifdef _SC_PII_SOCKET
302 { "_POSIX_PII_SOCKET", _SC_PII_SOCKET, SYSCONF },
303 #endif
304 #ifdef _SC_PII_XTI
305 { "_POSIX_PII_XTI", _SC_PII_XTI, SYSCONF },
306 #endif
307 #ifdef _SC_POLL
308 { "_POSIX_POLL", _SC_POLL, SYSCONF },
309 #endif
310 #ifdef _SC_PRIORITIZED_IO
311 { "_POSIX_PRIORITIZED_IO", _SC_PRIORITIZED_IO, SYSCONF },
312 #endif
313 #ifdef _SC_PRIORITY_SCHEDULING
314 { "_POSIX_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING, SYSCONF },
315 #endif
316 #ifdef _SC_REALTIME_SIGNALS
317 { "_POSIX_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS, SYSCONF },
318 #endif
319 #ifdef _SC_SAVED_IDS
320 { "_POSIX_SAVED_IDS", _SC_SAVED_IDS, SYSCONF },
321 #endif
322 #ifdef _SC_SELECT
323 { "_POSIX_SELECT", _SC_SELECT, SYSCONF },
324 #endif
325 #ifdef _SC_SEMAPHORES
326 { "_POSIX_SEMAPHORES", _SC_SEMAPHORES, SYSCONF },
327 #endif
328 #ifdef _SC_SHARED_MEMORY_OBJECTS
329 { "_POSIX_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS, SYSCONF },
330 #endif
331 #ifdef _SC_SSIZE_MAX
332 { "_POSIX_SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
333 #endif
334 #ifdef _SC_STREAM_MAX
335 { "_POSIX_STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
336 #endif
337 #ifdef _SC_SYNCHRONIZED_IO
338 { "_POSIX_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO, SYSCONF },
339 #endif
340 #ifdef _SC_THREADS
341 { "_POSIX_THREADS", _SC_THREADS, SYSCONF },
342 #endif
343 #ifdef _SC_THREAD_ATTR_STACKADDR
344 { "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
345 #endif
346 #ifdef _SC_THREAD_ATTR_STACKSIZE
347 { "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
348 #endif
349 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
350 { "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
351 #endif
352 #ifdef _SC_THREAD_PRIO_INHERIT
353 { "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
354 #endif
355 #ifdef _SC_THREAD_PRIO_PROTECT
356 { "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
357 #endif
358 #ifdef _SC_THREAD_PROCESS_SHARED
359 { "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
360 #endif
361 #ifdef _SC_THREAD_SAFE_FUNCTIONS
362 { "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
363 #endif
364 #ifdef _SC_TIMERS
365 { "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
366 #endif
367 #ifdef _SC_TIMER_MAX
368 { "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
369 #endif
370 #ifdef _SC_TZNAME_MAX
371 { "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
372 #endif
373 #ifdef _SC_VERSION
374 { "_POSIX_VERSION", _SC_VERSION, SYSCONF },
375 #endif
376 #ifdef _SC_T_IOV_MAX
377 { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
378 #endif
379 #ifdef _SC_XOPEN_CRYPT
380 { "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
381 #endif
382 #ifdef _SC_XOPEN_ENH_I18N
383 { "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
384 #endif
385 #ifdef _SC_XOPEN_LEGACY
386 { "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
387 #endif
388 #ifdef _SC_XOPEN_REALTIME
389 { "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
390 #endif
391 #ifdef _SC_XOPEN_REALTIME_THREADS
392 { "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
393 #endif
394 #ifdef _SC_XOPEN_SHM
395 { "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
396 #endif
397 #ifdef _SC_XOPEN_UNIX
398 { "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
399 #endif
400 #ifdef _SC_XOPEN_VERSION
401 { "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
402 #endif
403 #ifdef _SC_XOPEN_XCU_VERSION
404 { "_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION, SYSCONF },
405 #endif
406 #ifdef _SC_XOPEN_XPG2
407 { "_XOPEN_XPG2", _SC_XOPEN_XPG2, SYSCONF },
408 #endif
409 #ifdef _SC_XOPEN_XPG3
410 { "_XOPEN_XPG3", _SC_XOPEN_XPG3, SYSCONF },
411 #endif
412 #ifdef _SC_XOPEN_XPG4
413 { "_XOPEN_XPG4", _SC_XOPEN_XPG4, SYSCONF },
414 #endif
415 /* POSIX.2 */
416 #ifdef _SC_BC_BASE_MAX
417 { "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
418 #endif
419 #ifdef _SC_BC_DIM_MAX
420 { "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
421 #endif
422 #ifdef _SC_BC_SCALE_MAX
423 { "BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
424 #endif
425 #ifdef _SC_BC_STRING_MAX
426 { "BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
427 #endif
428 { "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
429 #ifdef _SC_COLL_WEIGHTS_MAX
430 { "COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
431 #endif
432 #ifdef _SC_EQUIV_CLASS_MAX
433 { "EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX, SYSCONF },
434 #endif
435 #ifdef _SC_EXPR_NEST_MAX
436 { "EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
437 #endif
438 #ifdef _SC_LINE_MAX
439 { "LINE_MAX", _SC_LINE_MAX, SYSCONF },
440 #endif
441 #ifdef _SC_BC_BASE_MAX
442 { "POSIX2_BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
443 #endif
444 #ifdef _SC_BC_DIM_MAX
445 { "POSIX2_BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
446 #endif
447 #ifdef _SC_BC_SCALE_MAX
448 { "POSIX2_BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
449 #endif
450 #ifdef _SC_BC_STRING_MAX
451 { "POSIX2_BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
452 #endif
453 #ifdef _SC_2_CHAR_TERM
454 { "POSIX2_CHAR_TERM", _SC_2_CHAR_TERM, SYSCONF },
455 #endif
456 #ifdef _SC_COLL_WEIGHTS_MAX
457 { "POSIX2_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
458 #endif
459 #ifdef _SC_2_C_BIND
460 { "POSIX2_C_BIND", _SC_2_C_BIND, SYSCONF },
461 #endif
462 #ifdef _SC_2_C_DEV
463 { "POSIX2_C_DEV", _SC_2_C_DEV, SYSCONF },
464 #endif
465 #ifdef _SC_2_C_VERSION
466 { "POSIX2_C_VERSION", _SC_2_C_VERSION, SYSCONF },
467 #endif
468 #ifdef _SC_EXPR_NEST_MAX
469 { "POSIX2_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
470 #endif
471 #ifdef _SC_2_FORT_DEV
472 { "POSIX2_FORT_DEV", _SC_2_FORT_DEV, SYSCONF },
473 #endif
474 #ifdef _SC_2_FORT_RUN
475 { "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
476 #endif
477 #ifdef _SC_LINE_MAX
478 { "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
479 #endif
480 #ifdef _SC_2_LOCALEDEF
481 { "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
482 #endif
483 #ifdef _SC_RE_DUP_MAX
484 { "POSIX2_RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
485 #endif
486 #ifdef _SC_2_SW_DEV
487 { "POSIX2_SW_DEV", _SC_2_SW_DEV, SYSCONF },
488 #endif
489 #ifdef _SC_2_UPE
490 { "POSIX2_UPE", _SC_2_UPE, SYSCONF },
491 #endif
492 #ifdef _SC_2_VERSION
493 { "POSIX2_VERSION", _SC_2_VERSION, SYSCONF },
494 #endif
495 #ifdef _SC_RE_DUP_MAX
496 { "RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
497 #endif
499 #ifdef _CS_PATH
500 { "PATH", _CS_PATH, CONFSTR },
501 { "CS_PATH", _CS_PATH, CONFSTR },
502 #endif
504 /* LFS */
505 #ifdef _CS_LFS_CFLAGS
506 { "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
507 #endif
508 #ifdef _CS_LFS_LDFLAGS
509 { "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
510 #endif
511 #ifdef _CS_LFS_LIBS
512 { "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
513 #endif
514 #ifdef _CS_LFS_LINTFLAGS
515 { "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
516 #endif
517 #ifdef _CS_LFS64_CFLAGS
518 { "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
519 #endif
520 #ifdef _CS_LFS64_LDFLAGS
521 { "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
522 #endif
523 #ifdef _CS_LFS64_LIBS
524 { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
525 #endif
526 #ifdef _CS_LFS64_LINTFLAGS
527 { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
528 #endif
530 /* Programming environments. */
531 #ifdef _SC_XBS5_ILP32_OFF32
532 { "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
533 #endif
534 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
535 { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
536 #endif
537 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
538 { "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
539 #endif
540 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
541 { "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
542 #endif
543 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
544 { "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
545 #endif
547 #ifdef _SC_XBS5_ILP32_OFFBIG
548 { "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
549 #endif
550 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
551 { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
552 #endif
553 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
554 { "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
555 #endif
556 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
557 { "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
558 #endif
559 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
560 { "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
561 #endif
563 #ifdef _SC_XBS5_LP64_OFF64
564 { "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
565 #endif
566 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
567 { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
568 #endif
569 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
570 { "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
571 #endif
572 #ifdef _CS_XBS5_LP64_OFF64_LIBS
573 { "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
574 #endif
575 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
576 { "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
577 #endif
579 #ifdef _SC_XBS5_LPBIG_OFFBIG
580 { "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
581 #endif
582 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
583 { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
584 #endif
585 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
586 { "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
587 #endif
588 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
589 { "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
590 #endif
591 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
592 { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
593 #endif
595 #ifdef _SC_V6_ILP32_OFF32
596 { "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
597 #endif
598 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
599 { "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
600 #endif
601 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
602 { "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
603 #endif
604 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
605 { "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
606 #endif
607 #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
608 { "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
609 #endif
611 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
612 { "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
613 { "POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
614 #endif
616 #ifdef _SC_V6_ILP32_OFFBIG
617 { "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
618 #endif
619 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
620 { "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
621 #endif
622 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
623 { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
624 #endif
625 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
626 { "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
627 #endif
628 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
629 { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
630 #endif
632 #ifdef _SC_V6_LP64_OFF64
633 { "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
634 #endif
635 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
636 { "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
637 #endif
638 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
639 { "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
640 #endif
641 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
642 { "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
643 #endif
644 #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
645 { "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
646 #endif
648 #ifdef _SC_V6_LPBIG_OFFBIG
649 { "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
650 #endif
651 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
652 { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
653 #endif
654 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
655 { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
656 #endif
657 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
658 { "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
659 #endif
660 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
661 { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
662 #endif
664 #ifdef _SC_ADVISORY_INFO
665 { "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
666 #endif
667 #ifdef _SC_BARRIERS
668 { "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
669 #endif
670 #ifdef _SC_BASE
671 { "_POSIX_BASE", _SC_BASE, SYSCONF },
672 #endif
673 #ifdef _SC_C_LANG_SUPPORT
674 { "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
675 #endif
676 #ifdef _SC_C_LANG_SUPPORT_R
677 { "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
678 #endif
679 #ifdef _SC_CLOCK_SELECTION
680 { "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
681 #endif
682 #ifdef _SC_CPUTIME
683 { "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
684 #endif
685 #ifdef _SC_THREAD_CPUTIME
686 { "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
687 #endif
688 #ifdef _SC_DEVICE_SPECIFIC
689 { "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
690 #endif
691 #ifdef _SC_DEVICE_SPECIFIC_R
692 { "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
693 #endif
694 #ifdef _SC_FD_MGMT
695 { "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
696 #endif
697 #ifdef _SC_FIFO
698 { "_POSIX_FIFO", _SC_FIFO, SYSCONF },
699 #endif
700 #ifdef _SC_PIPE
701 { "_POSIX_PIPE", _SC_PIPE, SYSCONF },
702 #endif
703 #ifdef _SC_FILE_ATTRIBUTES
704 { "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
705 #endif
706 #ifdef _SC_FILE_LOCKING
707 { "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
708 #endif
709 #ifdef _SC_FILE_SYSTEM
710 { "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
711 #endif
712 #ifdef _SC_MONOTONIC_CLOCK
713 { "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
714 #endif
715 #ifdef _SC_MULTI_PROCESS
716 { "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
717 #endif
718 #ifdef _SC_SINGLE_PROCESS
719 { "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
720 #endif
721 #ifdef _SC_NETWORKING
722 { "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
723 #endif
724 #ifdef _SC_READER_WRITER_LOCKS
725 { "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
726 #endif
727 #ifdef _SC_SPIN_LOCKS
728 { "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
729 #endif
730 #ifdef _SC_REGEXP
731 { "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
732 #endif
733 #ifdef _SC_REGEX_VERSION
734 { "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
735 #endif
736 #ifdef _SC_SHELL
737 { "_POSIX_SHELL", _SC_SHELL, SYSCONF },
738 #endif
739 #ifdef _SC_SIGNALS
740 { "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
741 #endif
742 #ifdef _SC_SPAWN
743 { "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
744 #endif
745 #ifdef _SC_SPORADIC_SERVER
746 { "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
747 #endif
748 #ifdef _SC_THREAD_SPORADIC_SERVER
749 { "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
750 #endif
751 #ifdef _SC_SYSTEM_DATABASE
752 { "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
753 #endif
754 #ifdef _SC_SYSTEM_DATABASE_R
755 { "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
756 #endif
757 #ifdef _SC_TIMEOUTS
758 { "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
759 #endif
760 #ifdef _SC_TYPED_MEMORY_OBJECTS
761 { "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
762 #endif
763 #ifdef _SC_USER_GROUPS
764 { "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
765 #endif
766 #ifdef _SC_USER_GROUPS_R
767 { "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
768 #endif
769 #ifdef _SC_2_PBS
770 { "POSIX2_PBS", _SC_2_PBS, SYSCONF },
771 #endif
772 #ifdef _SC_2_PBS_ACCOUNTING
773 { "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
774 #endif
775 #ifdef _SC_2_PBS_LOCATE
776 { "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
777 #endif
778 #ifdef _SC_2_PBS_TRACK
779 { "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
780 #endif
781 #ifdef _SC_2_PBS_MESSAGE
782 { "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
783 #endif
784 #ifdef _SC_SYMLOOP_MAX
785 { "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
786 #endif
787 #ifdef _SC_STREAM_MAX
788 { "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
789 #endif
790 #ifdef _SC_AIO_LISTIO_MAX
791 { "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
792 #endif
793 #ifdef _SC_AIO_MAX
794 { "AIO_MAX", _SC_AIO_MAX, SYSCONF },
795 #endif
796 #ifdef _SC_AIO_PRIO_DELTA_MAX
797 { "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
798 #endif
799 #ifdef _SC_DELAYTIMER_MAX
800 { "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
801 #endif
802 #ifdef _SC_HOST_NAME_MAX
803 { "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
804 #endif
805 #ifdef _SC_LOGIN_NAME_MAX
806 { "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
807 #endif
808 #ifdef _SC_MQ_OPEN_MAX
809 { "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
810 #endif
811 #ifdef _SC_MQ_PRIO_MAX
812 { "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
813 #endif
814 #ifdef _SC_DEVICE_IO
815 { "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
816 #endif
817 #ifdef _SC_TRACE
818 { "_POSIX_TRACE", _SC_TRACE, SYSCONF },
819 #endif
820 #ifdef _SC_TRACE_EVENT_FILTER
821 { "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
822 #endif
823 #ifdef _SC_TRACE_INHERIT
824 { "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
825 #endif
826 #ifdef _SC_TRACE_LOG
827 { "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
828 #endif
829 #ifdef _SC_RTSIG_MAX
830 { "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
831 #endif
832 #ifdef _SC_SEM_NSEMS_MAX
833 { "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
834 #endif
835 #ifdef _SC_SEM_VALUE_MAX
836 { "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
837 #endif
838 #ifdef _SC_SIGQUEUE_MAX
839 { "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
840 #endif
841 #ifdef _PC_FILESIZEBITS
842 { "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
843 #endif
844 #ifdef _PC_ALLOC_SIZE_MIN
845 { "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
846 #endif
847 #ifdef _PC_REC_INCR_XFER_SIZE
848 { "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
849 #endif
850 #ifdef _PC_REC_MAX_XFER_SIZE
851 { "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
852 #endif
853 #ifdef _PC_REC_MIN_XFER_SIZE
854 { "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
855 #endif
856 #ifdef _PC_REC_XFER_ALIGN
857 { "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
858 #endif
859 #ifdef _PC_SYMLINK_MAX
860 { "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
861 #endif
862 #ifdef _CS_GNU_LIBC_VERSION
863 { "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
864 #endif
865 #ifdef _CS_GNU_LIBPTHREAD_VERSION
866 { "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
867 #endif
868 #ifdef _PC_2_SYMLINKS
869 { "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
870 #endif
872 #ifdef _SC_LEVEL1_ICACHE_SIZE
873 { "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
874 #endif
875 #ifdef _SC_LEVEL1_ICACHE_ASSOC
876 { "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
877 #endif
878 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
879 { "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
880 #endif
881 #ifdef _SC_LEVEL1_DCACHE_SIZE
882 { "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
883 #endif
884 #ifdef _SC_LEVEL1_DCACHE_ASSOC
885 { "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
886 #endif
887 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
888 { "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
889 #endif
890 #ifdef _SC_LEVEL2_CACHE_SIZE
891 { "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
892 #endif
893 #ifdef _SC_LEVEL2_CACHE_ASSOC
894 { "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
895 #endif
896 #ifdef _SC_LEVEL2_CACHE_LINESIZE
897 { "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
898 #endif
899 #ifdef _SC_LEVEL3_CACHE_SIZE
900 { "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
901 #endif
902 #ifdef _SC_LEVEL3_CACHE_ASSOC
903 { "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
904 #endif
905 #ifdef _SC_LEVEL3_CACHE_LINESIZE
906 { "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
907 #endif
908 #ifdef _SC_LEVEL4_CACHE_SIZE
909 { "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
910 #endif
911 #ifdef _SC_LEVEL4_CACHE_ASSOC
912 { "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
913 #endif
914 #ifdef _SC_LEVEL4_CACHE_LINESIZE
915 { "LEVEL4_CACHE_LINESIZE", _SC_LEVEL4_CACHE_LINESIZE, SYSCONF },
916 #endif
918 #ifdef _SC_IPV6
919 { "IPV6", _SC_IPV6, SYSCONF },
920 #endif
921 #ifdef _SC_RAW_SOCKETS
922 { "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
923 #endif
925 { NULL, 0, SYSCONF }
929 static struct { const char *name; int num; } specs[] =
931 { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
932 { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
933 { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
934 { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG }
936 static const int nspecs = sizeof (specs) / sizeof (specs[0]);
938 extern const char *__progname;
941 static void
942 usage (void)
944 fprintf (stderr,
945 _("Usage: %s [-v specification] variable_name [pathname]\n"),
946 __progname);
947 fprintf (stderr,
948 _(" %s -a [pathname]\n"), __progname);
949 exit (2);
952 static void
953 print_all (const char *path)
955 register const struct conf *c;
956 size_t clen;
957 long int value;
958 char *cvalue;
959 for (c = vars; c->name != NULL; ++c) {
960 printf("%-35s", c->name);
961 switch (c->call) {
962 case PATHCONF:
963 value = pathconf (path, c->call_name);
964 if (value != -1) {
965 printf("%ld", value);
967 printf("\n");
968 break;
969 case SYSCONF:
970 value = sysconf (c->call_name);
971 if (value == -1l) {
972 if (c->call_name == _SC_UINT_MAX
973 || c->call_name == _SC_ULONG_MAX)
974 printf ("%lu", value);
976 else {
977 printf ("%ld", value);
979 printf ("\n");
980 break;
981 case CONFSTR:
982 clen = confstr (c->call_name, (char *) NULL, 0);
983 cvalue = (char *) malloc (clen);
984 if (cvalue == NULL)
985 error (3, 0, _("memory exhausted"));
986 if (confstr (c->call_name, cvalue, clen) != clen)
987 error (3, errno, "confstr");
988 printf ("%.*s\n", (int) clen, cvalue);
989 free (cvalue);
990 break;
993 exit (0);
997 main (int argc, char *argv[])
999 register const struct conf *c;
1001 /* Set locale. Do not set LC_ALL because the other categories must
1002 not be affected (according to POSIX.2). */
1003 setlocale (LC_CTYPE, "");
1004 setlocale (LC_MESSAGES, "");
1006 /* Initialize the message catalog. */
1007 textdomain (PACKAGE);
1009 if (argc > 1 && strcmp (argv[1], "--version") == 0)
1011 fprintf (stderr, "getconf (GNU %s) %s\n", PACKAGE, VERSION);
1012 fprintf (stderr, gettext ("\
1013 Copyright (C) %s Free Software Foundation, Inc.\n\
1014 This is free software; see the source for copying conditions. There is NO\n\
1015 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
1016 "), "2008");
1017 fprintf (stderr, gettext ("Written by %s.\n"), "Roland McGrath");
1018 return 0;
1021 const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
1022 size_t getconf_dirlen = strlen (getconf_dir);
1024 const char *spec = NULL;
1025 char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
1026 char *argv0 = argv[0];
1027 if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
1029 if (argv[1][2] == '\0')
1031 if (argc < 3)
1032 usage ();
1034 spec = argv[2];
1035 argv += 2;
1036 argc -= 2;
1038 else
1040 spec = &argv[1][2];
1041 argv += 1;
1042 argc += 1;
1045 else
1047 char default_name[getconf_dirlen + sizeof "/default"];
1048 memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
1049 "/default", sizeof "/default");
1050 int len = readlink (default_name, buf, sizeof buf - 1);
1051 if (len > 0)
1053 buf[len] = '\0';
1054 spec = buf;
1058 /* Check for the specifications we know. */
1059 if (spec != NULL)
1061 int i;
1062 for (i = 0; i < nspecs; ++i)
1063 if (strcmp (spec, specs[i].name) == 0)
1064 break;
1066 if (i == nspecs)
1067 error (2, 0, _("unknown specification \"%s\""), spec);
1069 switch (specs[i].num)
1071 #ifndef _POSIX_V6_ILP32_OFF32
1072 case _SC_V6_ILP32_OFF32:
1073 #endif
1074 #ifndef _POSIX_V6_ILP32_OFFBIG
1075 case _SC_V6_ILP32_OFFBIG:
1076 #endif
1077 #ifndef _POSIX_V6_LP64_OFF64
1078 case _SC_V6_LP64_OFF64:
1079 #endif
1080 #ifndef _POSIX_V6_LPBIG_OFFBIG
1081 case _SC_V6_LPBIG_OFFBIG:
1082 #endif
1084 const char *args[argc + 3];
1085 size_t spec_len = strlen (spec);
1086 char getconf_name[getconf_dirlen + 1 + spec_len + 1];
1087 memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
1088 getconf_dirlen),
1089 "/", 1), spec, spec_len + 1);
1090 args[0] = argv0;
1091 args[1] = "-v";
1092 args[2] = spec;
1093 memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
1094 execv (getconf_name, (char * const *) args);
1095 error (4, errno, _("Couldn't execute %s"), getconf_name);
1097 default:
1098 break;
1102 if (argc > 1 && strcmp (argv[1], "-a") == 0)
1104 if (argc == 2)
1105 print_all ("/");
1106 else if (argc == 3)
1107 print_all (argv[2]);
1108 else
1109 usage ();
1112 if (argc < 2 || argc > 3)
1113 usage ();
1115 for (c = vars; c->name != NULL; ++c)
1116 if (strcmp (c->name, argv[1]) == 0
1117 || (strncmp (c->name, "_POSIX_", 7) == 0
1118 && strcmp (c->name + 7, argv[1]) == 0))
1120 long int value;
1121 size_t clen;
1122 char *cvalue;
1123 switch (c->call)
1125 case PATHCONF:
1126 if (argc < 3)
1127 usage ();
1128 errno = 0;
1129 value = pathconf (argv[2], c->call_name);
1130 if (value == -1)
1132 if (errno)
1133 error (3, errno, "pathconf: %s", argv[2]);
1134 else
1135 puts (_("undefined"));
1137 else
1138 printf ("%ld\n", value);
1139 exit (0);
1141 case SYSCONF:
1142 if (argc > 2)
1143 usage ();
1144 value = sysconf (c->call_name);
1145 if (value == -1l)
1147 if (c->call_name == _SC_UINT_MAX
1148 || c->call_name == _SC_ULONG_MAX)
1149 printf ("%lu\n", value);
1150 else
1151 puts (_("undefined"));
1153 else
1154 printf ("%ld\n", value);
1155 exit (0);
1157 case CONFSTR:
1158 if (argc > 2)
1159 usage ();
1160 clen = confstr (c->call_name, (char *) NULL, 0);
1161 cvalue = (char *) malloc (clen);
1162 if (cvalue == NULL)
1163 error (3, 0, _("memory exhausted"));
1165 if (confstr (c->call_name, cvalue, clen) != clen)
1166 error (3, errno, "confstr");
1168 printf ("%.*s\n", (int) clen, cvalue);
1169 exit (0);
1173 error (2, 0, _("Unrecognized variable `%s'"), argv[1]);
1174 /* NOTREACHED */
1175 return 2;