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