Back to index

glibc  2.9
getconf.c
Go to the documentation of this file.
00001 /* Copyright (C) 1991, 92, 1995-2007, 2008 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published
00006    by the Free Software Foundation; version 2 of the License, or
00007    (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; if not, write to the Free Software Foundation,
00016    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00017 
00018 #include <unistd.h>
00019 #include <errno.h>
00020 #include <error.h>
00021 #include <libintl.h>
00022 #include <locale.h>
00023 #include <string.h>
00024 #include <stdlib.h>
00025 #include <stdio.h>
00026 
00027 #include "../version.h"
00028 #define PACKAGE _libc_intl_domainname
00029 
00030 struct conf
00031   {
00032     const char *name;
00033     const int call_name;
00034     const enum { SYSCONF, CONFSTR, PATHCONF } call;
00035   };
00036 
00037 static const struct conf vars[] =
00038   {
00039 #ifdef _PC_LINK_MAX
00040     { "LINK_MAX", _PC_LINK_MAX, PATHCONF },
00041 #endif
00042 #ifdef _PC_LINK_MAX
00043     { "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
00044 #endif
00045 #ifdef _PC_MAX_CANON
00046     { "MAX_CANON", _PC_MAX_CANON, PATHCONF },
00047 #endif
00048 #ifdef _PC_MAX_CANON
00049     { "_POSIX_MAX_CANON", _PC_MAX_CANON, PATHCONF },
00050 #endif
00051 #ifdef _PC_MAX_INPUT
00052     { "MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
00053 #endif
00054 #ifdef _PC_MAX_INPUT
00055     { "_POSIX_MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
00056 #endif
00057 #ifdef _PC_NAME_MAX
00058     { "NAME_MAX", _PC_NAME_MAX, PATHCONF },
00059 #endif
00060 #ifdef _PC_NAME_MAX
00061     { "_POSIX_NAME_MAX", _PC_NAME_MAX, PATHCONF },
00062 #endif
00063 #ifdef _PC_PATH_MAX
00064     { "PATH_MAX", _PC_PATH_MAX, PATHCONF },
00065 #endif
00066 #ifdef _PC_PATH_MAX
00067     { "_POSIX_PATH_MAX", _PC_PATH_MAX, PATHCONF },
00068 #endif
00069 #ifdef _PC_PIPE_BUF
00070     { "PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
00071 #endif
00072 #ifdef _PC_PIPE_BUF
00073     { "_POSIX_PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
00074 #endif
00075 #ifdef _PC_SOCK_MAXBUF
00076     { "SOCK_MAXBUF", _PC_SOCK_MAXBUF, PATHCONF },
00077 #endif
00078 #ifdef _PC_ASYNC_IO
00079     { "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF },
00080 #endif
00081 #ifdef _PC_CHOWN_RESTRICTED
00082     { "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF },
00083 #endif
00084 #ifdef _PC_NO_TRUNC
00085     { "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF },
00086 #endif
00087 #ifdef _PC_PRIO_IO
00088     { "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF },
00089 #endif
00090 #ifdef _PC_SYNC_IO
00091     { "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF },
00092 #endif
00093 #ifdef _PC_VDISABLE
00094     { "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF },
00095 #endif
00096 
00097 #ifdef _SC_ARG_MAX
00098     { "ARG_MAX", _SC_ARG_MAX, SYSCONF },
00099 #endif
00100 #ifdef _SC_ATEXIT_MAX
00101     { "ATEXIT_MAX", _SC_ATEXIT_MAX, SYSCONF },
00102 #endif
00103 #ifdef _SC_CHAR_BIT
00104     { "CHAR_BIT", _SC_CHAR_BIT, SYSCONF },
00105 #endif
00106 #ifdef _SC_CHAR_MAX
00107     { "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
00108 #endif
00109 #ifdef _SC_CHAR_MIN
00110     { "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
00111 #endif
00112 #ifdef _SC_CHILD_MAX
00113     { "CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
00114 #endif
00115 #ifdef _SC_CLK_TCK
00116     { "CLK_TCK", _SC_CLK_TCK, SYSCONF },
00117 #endif
00118 #ifdef _SC_INT_MAX
00119     { "INT_MAX", _SC_INT_MAX, SYSCONF },
00120 #endif
00121 #ifdef _SC_INT_MIN
00122     { "INT_MIN", _SC_INT_MIN, SYSCONF },
00123 #endif
00124 #ifdef _SC_UIO_MAXIOV
00125     { "IOV_MAX", _SC_UIO_MAXIOV, SYSCONF },
00126 #endif
00127 #ifdef _SC_LOGIN_NAME_MAX
00128     { "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
00129 #endif
00130 #ifdef _SC_LONG_BIT
00131     { "LONG_BIT", _SC_LONG_BIT, SYSCONF },
00132 #endif
00133 #ifdef _SC_MB_LEN_MAX
00134     { "MB_LEN_MAX", _SC_MB_LEN_MAX, SYSCONF },
00135 #endif
00136 #ifdef _SC_NGROUPS_MAX
00137     { "NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
00138 #endif
00139 #ifdef _SC_NL_ARGMAX
00140     { "NL_ARGMAX", _SC_NL_ARGMAX, SYSCONF },
00141 #endif
00142 #ifdef _SC_NL_LANGMAX
00143     { "NL_LANGMAX", _SC_NL_LANGMAX, SYSCONF },
00144 #endif
00145 #ifdef _SC_NL_MSGMAX
00146     { "NL_MSGMAX", _SC_NL_MSGMAX, SYSCONF },
00147 #endif
00148 #ifdef _SC_NL_NMAX
00149     { "NL_NMAX", _SC_NL_NMAX, SYSCONF },
00150 #endif
00151 #ifdef _SC_NL_SETMAX
00152     { "NL_SETMAX", _SC_NL_SETMAX, SYSCONF },
00153 #endif
00154 #ifdef _SC_NL_TEXTMAX
00155     { "NL_TEXTMAX", _SC_NL_TEXTMAX, SYSCONF },
00156 #endif
00157 #ifdef _SC_GETGR_R_SIZE_MAX
00158     { "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
00159 #endif
00160 #ifdef _SC_GETPW_R_SIZE_MAX
00161     { "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
00162 #endif
00163 #ifdef _SC_NZERO
00164     { "NZERO", _SC_NZERO, SYSCONF },
00165 #endif
00166 #ifdef _SC_OPEN_MAX
00167     { "OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
00168 #endif
00169 #ifdef _SC_PAGESIZE
00170     { "PAGESIZE", _SC_PAGESIZE, SYSCONF },
00171 #endif
00172 #ifdef _SC_PAGESIZE
00173     { "PAGE_SIZE", _SC_PAGESIZE, SYSCONF },
00174 #endif
00175 #ifdef _SC_PASS_MAX
00176     { "PASS_MAX", _SC_PASS_MAX, SYSCONF },
00177 #endif
00178 #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
00179     { "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
00180 #endif
00181 #ifdef _SC_THREAD_KEYS_MAX
00182     { "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
00183 #endif
00184 #ifdef _SC_THREAD_STACK_MIN
00185     { "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
00186 #endif
00187 #ifdef _SC_THREAD_THREADS_MAX
00188     { "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
00189 #endif
00190 #ifdef _SC_SCHAR_MAX
00191     { "SCHAR_MAX", _SC_SCHAR_MAX, SYSCONF },
00192 #endif
00193 #ifdef _SC_SCHAR_MIN
00194     { "SCHAR_MIN", _SC_SCHAR_MIN, SYSCONF },
00195 #endif
00196 #ifdef _SC_SHRT_MAX
00197     { "SHRT_MAX", _SC_SHRT_MAX, SYSCONF },
00198 #endif
00199 #ifdef _SC_SHRT_MIN
00200     { "SHRT_MIN", _SC_SHRT_MIN, SYSCONF },
00201 #endif
00202 #ifdef _SC_SSIZE_MAX
00203     { "SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
00204 #endif
00205 #ifdef _SC_TTY_NAME_MAX
00206     { "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
00207 #endif
00208 #ifdef _SC_TZNAME_MAX
00209     { "TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
00210 #endif
00211 #ifdef _SC_UCHAR_MAX
00212     { "UCHAR_MAX", _SC_UCHAR_MAX, SYSCONF },
00213 #endif
00214 #ifdef _SC_UINT_MAX
00215     { "UINT_MAX", _SC_UINT_MAX, SYSCONF },
00216 #endif
00217 #ifdef _SC_UIO_MAXIOV
00218     { "UIO_MAXIOV", _SC_UIO_MAXIOV, SYSCONF },
00219 #endif
00220 #ifdef _SC_ULONG_MAX
00221     { "ULONG_MAX", _SC_ULONG_MAX, SYSCONF },
00222 #endif
00223 #ifdef _SC_USHRT_MAX
00224     { "USHRT_MAX", _SC_USHRT_MAX, SYSCONF },
00225 #endif
00226 #ifdef _SC_WORD_BIT
00227     { "WORD_BIT", _SC_WORD_BIT, SYSCONF },
00228 #endif
00229 #ifdef _SC_AVPHYS_PAGES
00230     { "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
00231 #endif
00232 #ifdef _SC_NPROCESSORS_CONF
00233     { "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
00234 #endif
00235 #ifdef _SC_NPROCESSORS_ONLN
00236     { "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
00237 #endif
00238 #ifdef _SC_PHYS_PAGES
00239     { "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
00240 #endif
00241 #ifdef _SC_ARG_MAX
00242     { "_POSIX_ARG_MAX", _SC_ARG_MAX, SYSCONF },
00243 #endif
00244 #ifdef _SC_ASYNCHRONOUS_IO
00245     { "_POSIX_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO, SYSCONF },
00246 #endif
00247 #ifdef _SC_CHILD_MAX
00248     { "_POSIX_CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
00249 #endif
00250 #ifdef _SC_FSYNC
00251     { "_POSIX_FSYNC", _SC_FSYNC, SYSCONF },
00252 #endif
00253 #ifdef _SC_JOB_CONTROL
00254     { "_POSIX_JOB_CONTROL", _SC_JOB_CONTROL, SYSCONF },
00255 #endif
00256 #ifdef _SC_MAPPED_FILES
00257     { "_POSIX_MAPPED_FILES", _SC_MAPPED_FILES, SYSCONF },
00258 #endif
00259 #ifdef _SC_MEMLOCK
00260     { "_POSIX_MEMLOCK", _SC_MEMLOCK, SYSCONF },
00261 #endif
00262 #ifdef _SC_MEMLOCK_RANGE
00263     { "_POSIX_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE, SYSCONF },
00264 #endif
00265 #ifdef _SC_MEMORY_PROTECTION
00266     { "_POSIX_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION, SYSCONF },
00267 #endif
00268 #ifdef _SC_MESSAGE_PASSING
00269     { "_POSIX_MESSAGE_PASSING", _SC_MESSAGE_PASSING, SYSCONF },
00270 #endif
00271 #ifdef _SC_NGROUPS_MAX
00272     { "_POSIX_NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
00273 #endif
00274 #ifdef _SC_OPEN_MAX
00275     { "_POSIX_OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
00276 #endif
00277 #ifdef _SC_PII
00278     { "_POSIX_PII", _SC_PII, SYSCONF },
00279 #endif
00280 #ifdef _SC_PII_INTERNET
00281     { "_POSIX_PII_INTERNET", _SC_PII_INTERNET, SYSCONF },
00282 #endif
00283 #ifdef _SC_PII_INTERNET_DGRAM
00284     { "_POSIX_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM, SYSCONF },
00285 #endif
00286 #ifdef _SC_PII_INTERNET_STREAM
00287     { "_POSIX_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM, SYSCONF },
00288 #endif
00289 #ifdef _SC_PII_OSI
00290     { "_POSIX_PII_OSI", _SC_PII_OSI, SYSCONF },
00291 #endif
00292 #ifdef _SC_PII_OSI_CLTS
00293     { "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
00294 #endif
00295 #ifdef _SC_PII_OSI_COTS
00296     { "_POSIX_PII_OSI_COTS", _SC_PII_OSI_COTS, SYSCONF },
00297 #endif
00298 #ifdef _SC_PII_OSI_M
00299     { "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
00300 #endif
00301 #ifdef _SC_PII_SOCKET
00302     { "_POSIX_PII_SOCKET", _SC_PII_SOCKET, SYSCONF },
00303 #endif
00304 #ifdef _SC_PII_XTI
00305     { "_POSIX_PII_XTI", _SC_PII_XTI, SYSCONF },
00306 #endif
00307 #ifdef _SC_POLL
00308     { "_POSIX_POLL", _SC_POLL, SYSCONF },
00309 #endif
00310 #ifdef _SC_PRIORITIZED_IO
00311     { "_POSIX_PRIORITIZED_IO", _SC_PRIORITIZED_IO, SYSCONF },
00312 #endif
00313 #ifdef _SC_PRIORITY_SCHEDULING
00314     { "_POSIX_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING, SYSCONF },
00315 #endif
00316 #ifdef _SC_REALTIME_SIGNALS
00317     { "_POSIX_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS, SYSCONF },
00318 #endif
00319 #ifdef _SC_SAVED_IDS
00320     { "_POSIX_SAVED_IDS", _SC_SAVED_IDS, SYSCONF },
00321 #endif
00322 #ifdef _SC_SELECT
00323     { "_POSIX_SELECT", _SC_SELECT, SYSCONF },
00324 #endif
00325 #ifdef _SC_SEMAPHORES
00326     { "_POSIX_SEMAPHORES", _SC_SEMAPHORES, SYSCONF },
00327 #endif
00328 #ifdef _SC_SHARED_MEMORY_OBJECTS
00329     { "_POSIX_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS, SYSCONF },
00330 #endif
00331 #ifdef _SC_SSIZE_MAX
00332     { "_POSIX_SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
00333 #endif
00334 #ifdef _SC_STREAM_MAX
00335     { "_POSIX_STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
00336 #endif
00337 #ifdef _SC_SYNCHRONIZED_IO
00338     { "_POSIX_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO, SYSCONF },
00339 #endif
00340 #ifdef _SC_THREADS
00341     { "_POSIX_THREADS", _SC_THREADS, SYSCONF },
00342 #endif
00343 #ifdef _SC_THREAD_ATTR_STACKADDR
00344     { "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
00345 #endif
00346 #ifdef _SC_THREAD_ATTR_STACKSIZE
00347     { "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
00348 #endif
00349 #ifdef _SC_THREAD_PRIORITY_SCHEDULING
00350     { "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
00351 #endif
00352 #ifdef _SC_THREAD_PRIO_INHERIT
00353     { "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
00354 #endif
00355 #ifdef _SC_THREAD_PRIO_PROTECT
00356     { "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
00357 #endif
00358 #ifdef _SC_THREAD_PROCESS_SHARED
00359     { "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
00360 #endif
00361 #ifdef _SC_THREAD_SAFE_FUNCTIONS
00362     { "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
00363 #endif
00364 #ifdef _SC_TIMERS
00365     { "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
00366 #endif
00367 #ifdef _SC_TIMER_MAX
00368     { "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
00369 #endif
00370 #ifdef _SC_TZNAME_MAX
00371     { "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
00372 #endif
00373 #ifdef _SC_VERSION
00374     { "_POSIX_VERSION", _SC_VERSION, SYSCONF },
00375 #endif
00376 #ifdef _SC_T_IOV_MAX
00377     { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
00378 #endif
00379 #ifdef _SC_XOPEN_CRYPT
00380     { "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
00381 #endif
00382 #ifdef _SC_XOPEN_ENH_I18N
00383     { "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
00384 #endif
00385 #ifdef _SC_XOPEN_LEGACY
00386     { "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
00387 #endif
00388 #ifdef _SC_XOPEN_REALTIME
00389     { "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
00390 #endif
00391 #ifdef _SC_XOPEN_REALTIME_THREADS
00392     { "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
00393 #endif
00394 #ifdef _SC_XOPEN_SHM
00395     { "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
00396 #endif
00397 #ifdef _SC_XOPEN_UNIX
00398     { "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
00399 #endif
00400 #ifdef _SC_XOPEN_VERSION
00401     { "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
00402 #endif
00403 #ifdef _SC_XOPEN_XCU_VERSION
00404     { "_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION, SYSCONF },
00405 #endif
00406 #ifdef _SC_XOPEN_XPG2
00407     { "_XOPEN_XPG2", _SC_XOPEN_XPG2, SYSCONF },
00408 #endif
00409 #ifdef _SC_XOPEN_XPG3
00410     { "_XOPEN_XPG3", _SC_XOPEN_XPG3, SYSCONF },
00411 #endif
00412 #ifdef _SC_XOPEN_XPG4
00413     { "_XOPEN_XPG4", _SC_XOPEN_XPG4, SYSCONF },
00414 #endif
00415     /* POSIX.2  */
00416 #ifdef _SC_BC_BASE_MAX
00417     { "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
00418 #endif
00419 #ifdef _SC_BC_DIM_MAX
00420     { "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
00421 #endif
00422 #ifdef _SC_BC_SCALE_MAX
00423     { "BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
00424 #endif
00425 #ifdef _SC_BC_STRING_MAX
00426     { "BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
00427 #endif
00428     { "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
00429 #ifdef _SC_COLL_WEIGHTS_MAX
00430     { "COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
00431 #endif
00432 #ifdef _SC_EQUIV_CLASS_MAX
00433     { "EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX, SYSCONF },
00434 #endif
00435 #ifdef _SC_EXPR_NEST_MAX
00436     { "EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
00437 #endif
00438 #ifdef _SC_LINE_MAX
00439     { "LINE_MAX", _SC_LINE_MAX, SYSCONF },
00440 #endif
00441 #ifdef _SC_BC_BASE_MAX
00442     { "POSIX2_BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
00443 #endif
00444 #ifdef _SC_BC_DIM_MAX
00445     { "POSIX2_BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
00446 #endif
00447 #ifdef _SC_BC_SCALE_MAX
00448     { "POSIX2_BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
00449 #endif
00450 #ifdef _SC_BC_STRING_MAX
00451     { "POSIX2_BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
00452 #endif
00453 #ifdef _SC_2_CHAR_TERM
00454     { "POSIX2_CHAR_TERM", _SC_2_CHAR_TERM, SYSCONF },
00455 #endif
00456 #ifdef _SC_COLL_WEIGHTS_MAX
00457     { "POSIX2_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
00458 #endif
00459 #ifdef _SC_2_C_BIND
00460     { "POSIX2_C_BIND", _SC_2_C_BIND, SYSCONF },
00461 #endif
00462 #ifdef _SC_2_C_DEV
00463     { "POSIX2_C_DEV", _SC_2_C_DEV, SYSCONF },
00464 #endif
00465 #ifdef _SC_2_C_VERSION
00466     { "POSIX2_C_VERSION", _SC_2_C_VERSION, SYSCONF },
00467 #endif
00468 #ifdef _SC_EXPR_NEST_MAX
00469     { "POSIX2_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
00470 #endif
00471 #ifdef _SC_2_FORT_DEV
00472     { "POSIX2_FORT_DEV", _SC_2_FORT_DEV, SYSCONF },
00473 #endif
00474 #ifdef _SC_2_FORT_RUN
00475     { "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
00476 #endif
00477 #ifdef _SC_LINE_MAX
00478     { "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
00479 #endif
00480 #ifdef _SC_2_LOCALEDEF
00481     { "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
00482 #endif
00483 #ifdef _SC_RE_DUP_MAX
00484     { "POSIX2_RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
00485 #endif
00486 #ifdef _SC_2_SW_DEV
00487     { "POSIX2_SW_DEV", _SC_2_SW_DEV, SYSCONF },
00488 #endif
00489 #ifdef _SC_2_UPE
00490     { "POSIX2_UPE", _SC_2_UPE, SYSCONF },
00491 #endif
00492 #ifdef _SC_2_VERSION
00493     { "POSIX2_VERSION", _SC_2_VERSION, SYSCONF },
00494 #endif
00495 #ifdef _SC_RE_DUP_MAX
00496     { "RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
00497 #endif
00498 
00499 #ifdef _CS_PATH
00500     { "PATH", _CS_PATH, CONFSTR },
00501     { "CS_PATH", _CS_PATH, CONFSTR },
00502 #endif
00503 
00504     /* LFS */
00505 #ifdef _CS_LFS_CFLAGS
00506     { "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
00507 #endif
00508 #ifdef _CS_LFS_LDFLAGS
00509     { "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
00510 #endif
00511 #ifdef _CS_LFS_LIBS
00512     { "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
00513 #endif
00514 #ifdef _CS_LFS_LINTFLAGS
00515     { "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
00516 #endif
00517 #ifdef _CS_LFS64_CFLAGS
00518     { "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
00519 #endif
00520 #ifdef _CS_LFS64_LDFLAGS
00521     { "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
00522 #endif
00523 #ifdef _CS_LFS64_LIBS
00524     { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
00525 #endif
00526 #ifdef _CS_LFS64_LINTFLAGS
00527     { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
00528 #endif
00529 
00530     /* Programming environments.  */
00531 #ifdef _SC_XBS5_ILP32_OFF32
00532     { "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
00533 #endif
00534 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
00535     { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
00536 #endif
00537 #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
00538     { "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
00539 #endif
00540 #ifdef _CS_XBS5_ILP32_OFF32_LIBS
00541     { "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
00542 #endif
00543 #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
00544     { "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
00545 #endif
00546 
00547 #ifdef _SC_XBS5_ILP32_OFFBIG
00548     { "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
00549 #endif
00550 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
00551     { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
00552 #endif
00553 #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
00554     { "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
00555 #endif
00556 #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
00557     { "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
00558 #endif
00559 #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
00560     { "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
00561 #endif
00562 
00563 #ifdef _SC_XBS5_LP64_OFF64
00564     { "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
00565 #endif
00566 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
00567     { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
00568 #endif
00569 #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
00570     { "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
00571 #endif
00572 #ifdef _CS_XBS5_LP64_OFF64_LIBS
00573     { "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
00574 #endif
00575 #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
00576     { "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
00577 #endif
00578 
00579 #ifdef _SC_XBS5_LPBIG_OFFBIG
00580     { "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
00581 #endif
00582 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
00583     { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
00584 #endif
00585 #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
00586     { "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
00587 #endif
00588 #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
00589     { "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
00590 #endif
00591 #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
00592     { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
00593 #endif
00594 
00595 #ifdef _SC_V6_ILP32_OFF32
00596     { "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
00597 #endif
00598 #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
00599     { "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
00600 #endif
00601 #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
00602     { "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
00603 #endif
00604 #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
00605     { "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
00606 #endif
00607 #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
00608     { "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
00609 #endif
00610 
00611 #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
00612     { "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
00613     { "POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
00614 #endif
00615 
00616 #ifdef _SC_V6_ILP32_OFFBIG
00617     { "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
00618 #endif
00619 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
00620     { "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
00621 #endif
00622 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
00623     { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
00624 #endif
00625 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
00626     { "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
00627 #endif
00628 #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
00629     { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
00630 #endif
00631 
00632 #ifdef _SC_V6_LP64_OFF64
00633     { "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
00634 #endif
00635 #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
00636     { "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
00637 #endif
00638 #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
00639     { "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
00640 #endif
00641 #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
00642     { "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
00643 #endif
00644 #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
00645     { "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
00646 #endif
00647 
00648 #ifdef _SC_V6_LPBIG_OFFBIG
00649     { "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
00650 #endif
00651 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
00652     { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
00653 #endif
00654 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
00655     { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
00656 #endif
00657 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
00658     { "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
00659 #endif
00660 #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
00661     { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
00662 #endif
00663 
00664 #ifdef _SC_ADVISORY_INFO
00665     { "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
00666 #endif
00667 #ifdef _SC_BARRIERS
00668     { "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
00669 #endif
00670 #ifdef _SC_BASE
00671     { "_POSIX_BASE", _SC_BASE, SYSCONF },
00672 #endif
00673 #ifdef _SC_C_LANG_SUPPORT
00674     { "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
00675 #endif
00676 #ifdef _SC_C_LANG_SUPPORT_R
00677     { "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
00678 #endif
00679 #ifdef _SC_CLOCK_SELECTION
00680     { "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
00681 #endif
00682 #ifdef _SC_CPUTIME
00683     { "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
00684 #endif
00685 #ifdef _SC_THREAD_CPUTIME
00686     { "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
00687 #endif
00688 #ifdef _SC_DEVICE_SPECIFIC
00689     { "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
00690 #endif
00691 #ifdef _SC_DEVICE_SPECIFIC_R
00692     { "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
00693 #endif
00694 #ifdef _SC_FD_MGMT
00695     { "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
00696 #endif
00697 #ifdef _SC_FIFO
00698     { "_POSIX_FIFO", _SC_FIFO, SYSCONF },
00699 #endif
00700 #ifdef _SC_PIPE
00701     { "_POSIX_PIPE", _SC_PIPE, SYSCONF },
00702 #endif
00703 #ifdef _SC_FILE_ATTRIBUTES
00704     { "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
00705 #endif
00706 #ifdef _SC_FILE_LOCKING
00707     { "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
00708 #endif
00709 #ifdef _SC_FILE_SYSTEM
00710     { "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
00711 #endif
00712 #ifdef _SC_MONOTONIC_CLOCK
00713     { "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
00714 #endif
00715 #ifdef _SC_MULTI_PROCESS
00716     { "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
00717 #endif
00718 #ifdef _SC_SINGLE_PROCESS
00719     { "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
00720 #endif
00721 #ifdef _SC_NETWORKING
00722     { "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
00723 #endif
00724 #ifdef _SC_READER_WRITER_LOCKS
00725     { "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
00726 #endif
00727 #ifdef _SC_SPIN_LOCKS
00728     { "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
00729 #endif
00730 #ifdef _SC_REGEXP
00731     { "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
00732 #endif
00733 #ifdef _SC_REGEX_VERSION
00734     { "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
00735 #endif
00736 #ifdef _SC_SHELL
00737     { "_POSIX_SHELL", _SC_SHELL, SYSCONF },
00738 #endif
00739 #ifdef _SC_SIGNALS
00740     { "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
00741 #endif
00742 #ifdef _SC_SPAWN
00743     { "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
00744 #endif
00745 #ifdef _SC_SPORADIC_SERVER
00746     { "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
00747 #endif
00748 #ifdef _SC_THREAD_SPORADIC_SERVER
00749     { "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
00750 #endif
00751 #ifdef _SC_SYSTEM_DATABASE
00752     { "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
00753 #endif
00754 #ifdef _SC_SYSTEM_DATABASE_R
00755     { "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
00756 #endif
00757 #ifdef _SC_TIMEOUTS
00758     { "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
00759 #endif
00760 #ifdef _SC_TYPED_MEMORY_OBJECTS
00761     { "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
00762 #endif
00763 #ifdef _SC_USER_GROUPS
00764     { "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
00765 #endif
00766 #ifdef _SC_USER_GROUPS_R
00767     { "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
00768 #endif
00769 #ifdef _SC_2_PBS
00770     { "POSIX2_PBS", _SC_2_PBS, SYSCONF },
00771 #endif
00772 #ifdef _SC_2_PBS_ACCOUNTING
00773     { "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
00774 #endif
00775 #ifdef _SC_2_PBS_LOCATE
00776     { "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
00777 #endif
00778 #ifdef _SC_2_PBS_TRACK
00779     { "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
00780 #endif
00781 #ifdef _SC_2_PBS_MESSAGE
00782     { "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
00783 #endif
00784 #ifdef _SC_SYMLOOP_MAX
00785     { "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
00786 #endif
00787 #ifdef _SC_STREAM_MAX
00788     { "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
00789 #endif
00790 #ifdef _SC_AIO_LISTIO_MAX
00791     { "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
00792 #endif
00793 #ifdef _SC_AIO_MAX
00794     { "AIO_MAX", _SC_AIO_MAX, SYSCONF },
00795 #endif
00796 #ifdef _SC_AIO_PRIO_DELTA_MAX
00797     { "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
00798 #endif
00799 #ifdef _SC_DELAYTIMER_MAX
00800     { "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
00801 #endif
00802 #ifdef _SC_HOST_NAME_MAX
00803     { "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
00804 #endif
00805 #ifdef _SC_LOGIN_NAME_MAX
00806     { "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
00807 #endif
00808 #ifdef _SC_MQ_OPEN_MAX
00809     { "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
00810 #endif
00811 #ifdef _SC_MQ_PRIO_MAX
00812     { "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
00813 #endif
00814 #ifdef _SC_DEVICE_IO
00815     { "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
00816 #endif
00817 #ifdef _SC_TRACE
00818     { "_POSIX_TRACE", _SC_TRACE, SYSCONF },
00819 #endif
00820 #ifdef _SC_TRACE_EVENT_FILTER
00821     { "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
00822 #endif
00823 #ifdef _SC_TRACE_INHERIT
00824     { "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
00825 #endif
00826 #ifdef _SC_TRACE_LOG
00827     { "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
00828 #endif
00829 #ifdef _SC_RTSIG_MAX
00830     { "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
00831 #endif
00832 #ifdef _SC_SEM_NSEMS_MAX
00833     { "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
00834 #endif
00835 #ifdef _SC_SEM_VALUE_MAX
00836     { "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
00837 #endif
00838 #ifdef _SC_SIGQUEUE_MAX
00839     { "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
00840 #endif
00841 #ifdef _PC_FILESIZEBITS
00842     { "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
00843 #endif
00844 #ifdef _PC_ALLOC_SIZE_MIN
00845     { "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
00846 #endif
00847 #ifdef _PC_REC_INCR_XFER_SIZE
00848     { "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
00849 #endif
00850 #ifdef _PC_REC_MAX_XFER_SIZE
00851     { "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
00852 #endif
00853 #ifdef _PC_REC_MIN_XFER_SIZE
00854     { "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
00855 #endif
00856 #ifdef _PC_REC_XFER_ALIGN
00857     { "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
00858 #endif
00859 #ifdef _PC_SYMLINK_MAX
00860     { "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
00861 #endif
00862 #ifdef _CS_GNU_LIBC_VERSION
00863     { "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
00864 #endif
00865 #ifdef _CS_GNU_LIBPTHREAD_VERSION
00866     { "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
00867 #endif
00868 #ifdef _PC_2_SYMLINKS
00869     { "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
00870 #endif
00871 
00872 #ifdef _SC_LEVEL1_ICACHE_SIZE
00873     { "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
00874 #endif
00875 #ifdef _SC_LEVEL1_ICACHE_ASSOC
00876     { "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
00877 #endif
00878 #ifdef _SC_LEVEL1_ICACHE_LINESIZE
00879     { "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
00880 #endif
00881 #ifdef _SC_LEVEL1_DCACHE_SIZE
00882     { "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
00883 #endif
00884 #ifdef _SC_LEVEL1_DCACHE_ASSOC
00885     { "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
00886 #endif
00887 #ifdef _SC_LEVEL1_DCACHE_LINESIZE
00888     { "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
00889 #endif
00890 #ifdef _SC_LEVEL2_CACHE_SIZE
00891     { "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
00892 #endif
00893 #ifdef _SC_LEVEL2_CACHE_ASSOC
00894     { "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
00895 #endif
00896 #ifdef _SC_LEVEL2_CACHE_LINESIZE
00897     { "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
00898 #endif
00899 #ifdef _SC_LEVEL3_CACHE_SIZE
00900     { "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
00901 #endif
00902 #ifdef _SC_LEVEL3_CACHE_ASSOC
00903     { "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
00904 #endif
00905 #ifdef _SC_LEVEL3_CACHE_LINESIZE
00906     { "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
00907 #endif
00908 #ifdef _SC_LEVEL4_CACHE_SIZE
00909     { "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
00910 #endif
00911 #ifdef _SC_LEVEL4_CACHE_ASSOC
00912     { "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
00913 #endif
00914 #ifdef _SC_LEVEL4_CACHE_LINESIZE
00915     { "LEVEL4_CACHE_LINESIZE", _SC_LEVEL4_CACHE_LINESIZE, SYSCONF },
00916 #endif
00917 
00918 #ifdef _SC_IPV6
00919     { "IPV6", _SC_IPV6, SYSCONF },
00920 #endif
00921 #ifdef _SC_RAW_SOCKETS
00922     { "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
00923 #endif
00924 
00925     { NULL, 0, SYSCONF }
00926   };
00927 
00928 
00929 static struct { const char *name; int num; } specs[] =
00930   {
00931     { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
00932     { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
00933     { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
00934     { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG }
00935   };
00936 static const int nspecs = sizeof (specs) / sizeof (specs[0]);
00937 
00938 extern const char *__progname;
00939 
00940 
00941 static void
00942 usage (void)
00943 {
00944   fprintf (stderr,
00945           _("Usage: %s [-v specification] variable_name [pathname]\n"),
00946           __progname);
00947   fprintf (stderr,
00948           _("       %s -a [pathname]\n"), __progname);
00949   exit (2);
00950 }
00951 
00952 static void
00953 print_all (const char *path)
00954 {
00955   register const struct conf *c;
00956   size_t clen;
00957   long int value;
00958   char *cvalue;
00959   for (c = vars; c->name != NULL; ++c) {
00960     printf("%-35s", c->name);
00961     switch (c->call) {
00962       case PATHCONF:
00963         value = pathconf (path, c->call_name);
00964         if (value != -1) {
00965           printf("%ld", value);
00966         }
00967         printf("\n");
00968         break;
00969       case SYSCONF:
00970         value = sysconf (c->call_name);
00971         if (value == -1l) {
00972           if (c->call_name == _SC_UINT_MAX
00973             || c->call_name == _SC_ULONG_MAX)
00974             printf ("%lu", value);
00975         }
00976         else {
00977           printf ("%ld", value);
00978         }
00979         printf ("\n");
00980         break;
00981       case CONFSTR:
00982         clen = confstr (c->call_name, (char *) NULL, 0);
00983         cvalue = (char *) malloc (clen);
00984         if (cvalue == NULL)
00985           error (3, 0, _("memory exhausted"));
00986         if (confstr (c->call_name, cvalue, clen) != clen)
00987           error (3, errno, "confstr");
00988         printf ("%.*s\n", (int) clen, cvalue);
00989        free (cvalue);
00990         break;
00991     }
00992   }
00993   exit (0);
00994 }
00995 
00996 int
00997 main (int argc, char *argv[])
00998 {
00999   register const struct conf *c;
01000 
01001   /* Set locale.  Do not set LC_ALL because the other categories must
01002      not be affected (according to POSIX.2).  */
01003   setlocale (LC_CTYPE, "");
01004   setlocale (LC_MESSAGES, "");
01005 
01006   /* Initialize the message catalog.  */
01007   textdomain (PACKAGE);
01008 
01009   if (argc > 1 && strcmp (argv[1], "--version") == 0)
01010     {
01011       fprintf (stderr, "getconf (GNU %s) %s\n", PACKAGE, VERSION);
01012       fprintf (stderr, gettext ("\
01013 Copyright (C) %s Free Software Foundation, Inc.\n\
01014 This is free software; see the source for copying conditions.  There is NO\n\
01015 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
01016 "), "2008");
01017       fprintf (stderr, gettext ("Written by %s.\n"), "Roland McGrath");
01018       return 0;
01019     }
01020 
01021   const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
01022   size_t getconf_dirlen = strlen (getconf_dir);
01023 
01024   const char *spec = NULL;
01025   char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
01026   char *argv0 = argv[0];
01027   if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
01028     {
01029       if (argv[1][2] == '\0')
01030        {
01031          if (argc < 3)
01032            usage ();
01033 
01034          spec = argv[2];
01035          argv += 2;
01036          argc -= 2;
01037        }
01038       else
01039        {
01040          spec = &argv[1][2];
01041          argv += 1;
01042          argc += 1;
01043        }
01044     }
01045   else
01046     {
01047       char default_name[getconf_dirlen + sizeof "/default"];
01048       memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
01049              "/default", sizeof "/default");
01050       int len = readlink (default_name, buf, sizeof buf - 1);
01051       if (len > 0)
01052        {
01053          buf[len] = '\0';
01054          spec = buf;
01055        }
01056     }
01057 
01058   /* Check for the specifications we know.  */
01059   if (spec != NULL)
01060     {
01061       int i;
01062       for (i = 0; i < nspecs; ++i)
01063        if (strcmp (spec, specs[i].name) == 0)
01064          break;
01065 
01066       if (i == nspecs)
01067        error (2, 0, _("unknown specification \"%s\""), spec);
01068 
01069       switch (specs[i].num)
01070        {
01071 #ifndef _POSIX_V6_ILP32_OFF32
01072          case _SC_V6_ILP32_OFF32:
01073 #endif
01074 #ifndef _POSIX_V6_ILP32_OFFBIG
01075          case _SC_V6_ILP32_OFFBIG:
01076 #endif
01077 #ifndef _POSIX_V6_LP64_OFF64
01078          case _SC_V6_LP64_OFF64:
01079 #endif
01080 #ifndef _POSIX_V6_LPBIG_OFFBIG
01081          case _SC_V6_LPBIG_OFFBIG:
01082 #endif
01083            {
01084              const char *args[argc + 3];
01085              size_t spec_len = strlen (spec);
01086              char getconf_name[getconf_dirlen + 1 + spec_len + 1];
01087              memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
01088                                    getconf_dirlen),
01089                             "/", 1), spec, spec_len + 1);
01090              args[0] = argv0;
01091              args[1] = "-v";
01092              args[2] = spec;
01093              memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
01094              execv (getconf_name, (char * const *) args);
01095              error (4, errno, _("Couldn't execute %s"), getconf_name);
01096            }
01097          default:
01098            break;
01099        }
01100     }
01101 
01102   if (argc > 1 && strcmp (argv[1], "-a") == 0)
01103     {
01104       if (argc == 2)
01105        print_all ("/");
01106       else if (argc == 3)
01107        print_all (argv[2]);
01108       else
01109        usage ();
01110     }
01111 
01112   if (argc < 2 || argc > 3)
01113     usage ();
01114 
01115   for (c = vars; c->name != NULL; ++c)
01116     if (strcmp (c->name, argv[1]) == 0
01117        || (strncmp (c->name, "_POSIX_", 7) == 0
01118            && strcmp (c->name + 7, argv[1]) == 0))
01119       {
01120        long int value;
01121        size_t clen;
01122        char *cvalue;
01123        switch (c->call)
01124          {
01125          case PATHCONF:
01126            if (argc < 3)
01127              usage ();
01128            errno = 0;
01129            value = pathconf (argv[2], c->call_name);
01130            if (value == -1)
01131              {
01132               if (errno)
01133                 error (3, errno, "pathconf: %s", argv[2]);
01134               else
01135                 puts (_("undefined"));
01136              }
01137            else
01138              printf ("%ld\n", value);
01139            exit (0);
01140 
01141          case SYSCONF:
01142            if (argc > 2)
01143              usage ();
01144            value = sysconf (c->call_name);
01145            if (value == -1l)
01146              {
01147               if (c->call_name == _SC_UINT_MAX
01148                   || c->call_name == _SC_ULONG_MAX)
01149                 printf ("%lu\n", value);
01150               else
01151                 puts (_("undefined"));
01152              }
01153            else
01154              printf ("%ld\n", value);
01155            exit (0);
01156 
01157          case CONFSTR:
01158            if (argc > 2)
01159              usage ();
01160            clen = confstr (c->call_name, (char *) NULL, 0);
01161            cvalue = (char *) malloc (clen);
01162            if (cvalue == NULL)
01163              error (3, 0, _("memory exhausted"));
01164 
01165            if (confstr (c->call_name, cvalue, clen) != clen)
01166              error (3, errno, "confstr");
01167 
01168            printf ("%.*s\n", (int) clen, cvalue);
01169            exit (0);
01170          }
01171       }
01172 
01173   error (2, 0, _("Unrecognized variable `%s'"), argv[1]);
01174   /* NOTREACHED */
01175   return 2;
01176 }