Adjust for changes to getaddrinfo.c.
[kopensolaris-gnu/glibc.git] / posix / getconf.c
index a1eb7ae..66e582e 100644 (file)
@@ -1,20 +1,18 @@
-/* Copyright (C) 1991, 92, 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 1995-2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2 as
+   published by the Free Software Foundation.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include <unistd.h>
 #include <errno.h>
@@ -365,6 +363,9 @@ static const struct conf vars[] =
 #ifdef _SC_TIMERS
     { "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
 #endif
+#ifdef _SC_TIMER_MAX
+    { "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
+#endif
 #ifdef _SC_TZNAME_MAX
     { "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
 #endif
@@ -473,7 +474,7 @@ static const struct conf vars[] =
     { "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
 #endif
 #ifdef _SC_LINE_MAX
-    { "POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
+    { "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
 #endif
 #ifdef _SC_2_LOCALEDEF
     { "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
@@ -496,8 +497,6 @@ static const struct conf vars[] =
 
 #ifdef _CS_PATH
     { "PATH", _CS_PATH, CONFSTR },
-#endif
-#ifdef _CS_PATH
     { "CS_PATH", _CS_PATH, CONFSTR },
 #endif
 
@@ -529,7 +528,7 @@ static const struct conf vars[] =
 
     /* Programming environments.  */
 #ifdef _SC_XBS5_ILP32_OFF32
-    { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
+    { "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
 #endif
 #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
     { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
@@ -545,7 +544,7 @@ static const struct conf vars[] =
 #endif
 
 #ifdef _SC_XBS5_ILP32_OFFBIG
-    { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
+    { "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
 #endif
 #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
     { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
@@ -561,7 +560,7 @@ static const struct conf vars[] =
 #endif
 
 #ifdef _SC_XBS5_LP64_OFF64
-    { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
+    { "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
 #endif
 #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
     { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
@@ -577,7 +576,7 @@ static const struct conf vars[] =
 #endif
 
 #ifdef _SC_XBS5_LPBIG_OFFBIG
-    { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
+    { "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
 #endif
 #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
     { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
@@ -592,146 +591,402 @@ static const struct conf vars[] =
     { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
 #endif
 
+#ifdef _SC_V6_ILP32_OFF32
+    { "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
+    { "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+    { "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
+    { "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
+    { "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
+#endif
+
+#ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
+    { "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
+#endif
+
+#ifdef _SC_V6_ILP32_OFFBIG
+    { "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+    { "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+    { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
+    { "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
+    { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
+#endif
+
+#ifdef _SC_V6_LP64_OFF64
+    { "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
+#endif
+#ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
+    { "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
+    { "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
+    { "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
+    { "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
+#endif
+
+#ifdef _SC_V6_LPBIG_OFFBIG
+    { "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
+#endif
+#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+    { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+    { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+    { "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
+#endif
+#ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+    { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
+#endif
+
 #ifdef _SC_ADVISORY_INFO
-    { "ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
+    { "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
 #endif
 #ifdef _SC_BARRIERS
-    { "BARRIERS", _SC_BARRIERS, SYSCONF },
+    { "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
 #endif
 #ifdef _SC_BASE
-    { "BASE", _SC_BASE, SYSCONF },
+    { "_POSIX_BASE", _SC_BASE, SYSCONF },
 #endif
 #ifdef _SC_C_LANG_SUPPORT
-    { "C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
+    { "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
 #endif
 #ifdef _SC_C_LANG_SUPPORT_R
-    { "C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
+    { "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
 #endif
 #ifdef _SC_CLOCK_SELECTION
-    { "CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
+    { "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
 #endif
 #ifdef _SC_CPUTIME
-    { "CPUTIME", _SC_CPUTIME, SYSCONF },
+    { "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
 #endif
 #ifdef _SC_THREAD_CPUTIME
-    { "THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
+    { "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
 #endif
 #ifdef _SC_DEVICE_SPECIFIC
-    { "DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
+    { "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
 #endif
 #ifdef _SC_DEVICE_SPECIFIC_R
-    { "DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
+    { "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
 #endif
 #ifdef _SC_FD_MGMT
-    { "FD_MGMT", _SC_FD_MGMT, SYSCONF },
+    { "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
 #endif
 #ifdef _SC_FIFO
-    { "FIFO", _SC_FIFO, SYSCONF },
+    { "_POSIX_FIFO", _SC_FIFO, SYSCONF },
 #endif
 #ifdef _SC_PIPE
-    { "PIPE", _SC_PIPE, SYSCONF },
+    { "_POSIX_PIPE", _SC_PIPE, SYSCONF },
 #endif
 #ifdef _SC_FILE_ATTRIBUTES
-    { "FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
+    { "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
 #endif
 #ifdef _SC_FILE_LOCKING
-    { "FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
+    { "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
 #endif
 #ifdef _SC_FILE_SYSTEM
-    { "FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
+    { "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
 #endif
 #ifdef _SC_MONOTONIC_CLOCK
-    { "MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
+    { "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
 #endif
-#ifdef _SC_MULTIPLE_PROCESS
-    { "MULTIPLE_PROCESS", _SC_MULTIPLE_PROCESS, SYSCONF },
+#ifdef _SC_MULTI_PROCESS
+    { "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
 #endif
 #ifdef _SC_SINGLE_PROCESS
-    { "SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
+    { "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
 #endif
 #ifdef _SC_NETWORKING
-    { "NETWORKING", _SC_NETWORKING, SYSCONF },
+    { "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
 #endif
 #ifdef _SC_READER_WRITER_LOCKS
-    { "READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
+    { "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
 #endif
 #ifdef _SC_SPIN_LOCKS
-    { "SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
-#endif
-#ifdef _SC_REXEXP
-    { "REGEXP", _SC_REXEXP, SYSCONF },
+    { "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
 #endif
-#ifdef _SC_REXEXP
-    { "REGEXP", _SC_REXEXP, SYSCONF },
+#ifdef _SC_REGEXP
+    { "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
 #endif
-#ifdef _SC_REXEX_VERSION
-    { "REGEX_VERSION", _SC_REXEX_VERSION, SYSCONF },
+#ifdef _SC_REGEX_VERSION
+    { "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
 #endif
 #ifdef _SC_SHELL
-    { "SHELL", _SC_SHELL, SYSCONF },
+    { "_POSIX_SHELL", _SC_SHELL, SYSCONF },
 #endif
 #ifdef _SC_SIGNALS
-    { "SIGNALS", _SC_SIGNALS, SYSCONF },
+    { "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
 #endif
 #ifdef _SC_SPAWN
-    { "SPAWN", _SC_SPAWN, SYSCONF },
+    { "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
 #endif
 #ifdef _SC_SPORADIC_SERVER
-    { "SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
+    { "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
 #endif
 #ifdef _SC_THREAD_SPORADIC_SERVER
-    { "THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
+    { "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
 #endif
 #ifdef _SC_SYSTEM_DATABASE
-    { "SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
+    { "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
 #endif
 #ifdef _SC_SYSTEM_DATABASE_R
-    { "SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
+    { "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
 #endif
 #ifdef _SC_TIMEOUTS
-    { "TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
+    { "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
 #endif
 #ifdef _SC_TYPED_MEMORY_OBJECTS
-    { "TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
+    { "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
 #endif
 #ifdef _SC_USER_GROUPS
-    { "USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
+    { "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
 #endif
 #ifdef _SC_USER_GROUPS_R
-    { "USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
+    { "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
+#endif
+#ifdef _SC_2_PBS
+    { "POSIX2_PBS", _SC_2_PBS, SYSCONF },
+#endif
+#ifdef _SC_2_PBS_ACCOUNTING
+    { "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
+#endif
+#ifdef _SC_2_PBS_LOCATE
+    { "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
+#endif
+#ifdef _SC_2_PBS_TRACK
+    { "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
+#endif
+#ifdef _SC_2_PBS_MESSAGE
+    { "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
+#endif
+#ifdef _SC_SYMLOOP_MAX
+    { "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
+#endif
+#ifdef _SC_STREAM_MAX
+    { "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
+#endif
+#ifdef _SC_AIO_LISTIO_MAX
+    { "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
+#endif
+#ifdef _SC_AIO_MAX
+    { "AIO_MAX", _SC_AIO_MAX, SYSCONF },
+#endif
+#ifdef _SC_AIO_PRIO_DELTA_MAX
+    { "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
+#endif
+#ifdef _SC_DELAYTIMER_MAX
+    { "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
+#endif
+#ifdef _SC_HOST_NAME_MAX
+    { "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
+#endif
+#ifdef _SC_LOGIN_NAME_MAX
+    { "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
+#endif
+#ifdef _SC_MQ_OPEN_MAX
+    { "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
+#endif
+#ifdef _SC_MQ_PRIO_MAX
+    { "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
+#endif
+#ifdef _SC_DEVICE_IO
+    { "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
+#endif
+#ifdef _SC_TRACE
+    { "_POSIX_TRACE", _SC_TRACE, SYSCONF },
+#endif
+#ifdef _SC_TRACE_EVENT_FILTER
+    { "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
+#endif
+#ifdef _SC_TRACE_INHERIT
+    { "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
+#endif
+#ifdef _SC_TRACE_LOG
+    { "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
 #endif
-#ifdef _SC_PBS
-    { "PBS", _SC_PBS, SYSCONF },
+#ifdef _SC_RTSIG_MAX
+    { "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
 #endif
-#ifdef _SC_PBS_ACCOUNTING
-    { "PBS_ACCOUNT", _SC_PBS_ACCOUNTING, SYSCONF },
+#ifdef _SC_SEM_NSEMS_MAX
+    { "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
 #endif
-#ifdef _SC_PBS_LOCATE
-    { "PBS_LOCATE", _SC_PBS_LOCATE, SYSCONF },
+#ifdef _SC_SEM_VALUE_MAX
+    { "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
 #endif
-#ifdef _SC_PBS_TRACK
-    { "PBS_TRACK", _SC_PBS_TRACK, SYSCONF },
+#ifdef _SC_SIGQUEUE_MAX
+    { "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
 #endif
-#ifdef _SC_PBS_MESSAGE
-    { "PBS_MESSAGE", _SC_PBS_MESSAGE, SYSCONF },
+#ifdef _PC_FILESIZEBITS
+    { "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
 #endif
-#ifdef _SC_SYMLOOP
-    { "SYMLOOP", _SC_SYMLOOP, SYSCONF },
+#ifdef _PC_ALLOC_SIZE_MIN
+    { "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
+#endif
+#ifdef _PC_REC_INCR_XFER_SIZE
+    { "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
+#endif
+#ifdef _PC_REC_MAX_XFER_SIZE
+    { "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
+#endif
+#ifdef _PC_REC_MIN_XFER_SIZE
+    { "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
+#endif
+#ifdef _PC_REC_XFER_ALIGN
+    { "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
+#endif
+#ifdef _PC_SYMLINK_MAX
+    { "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
+#endif
+#ifdef _CS_GNU_LIBC_VERSION
+    { "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
+#endif
+#ifdef _CS_GNU_LIBPTHREAD_VERSION
+    { "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
+#endif
+#ifdef _PC_2_SYMLINKS
+    { "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
+#endif
+
+#ifdef _SC_LEVEL1_ICACHE_SIZE
+    { "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL1_ICACHE_ASSOC
+    { "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
+#endif
+#ifdef _SC_LEVEL1_ICACHE_LINESIZE
+    { "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL1_DCACHE_SIZE
+    { "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL1_DCACHE_ASSOC
+    { "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
+#endif
+#ifdef _SC_LEVEL1_DCACHE_LINESIZE
+    { "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL2_CACHE_SIZE
+    { "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL2_CACHE_ASSOC
+    { "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
+#endif
+#ifdef _SC_LEVEL2_CACHE_LINESIZE
+    { "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL3_CACHE_SIZE
+    { "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL3_CACHE_ASSOC
+    { "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
+#endif
+#ifdef _SC_LEVEL3_CACHE_LINESIZE
+    { "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL4_CACHE_SIZE
+    { "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
+#endif
+#ifdef _SC_LEVEL4_CACHE_ASSOC
+    { "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
+#endif
+
+#ifdef _SC_IPV6
+    { "IPV6", _SC_IPV6, SYSCONF },
+#endif
+#ifdef _SC_RAW_SOCKETS
+    { "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
 #endif
 
     { NULL, 0, SYSCONF }
   };
 
+
+static struct { const char *name; int num; } specs[] =
+  {
+    { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
+    { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
+    { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
+    { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG }
+  };
+static const int nspecs = sizeof (specs) / sizeof (specs[0]);
+
 extern const char *__progname;
 
 
 static void
 usage (void)
 {
-  fprintf (stderr, _("Usage: %s variable_name [pathname]\n"), __progname);
+  fprintf (stderr,
+          _("Usage: %s [-v specification] variable_name [pathname]\n"),
+          __progname);
+  fprintf (stderr,
+          _("       %s -a [pathname]\n"), __progname);
   exit (2);
 }
 
+static void
+print_all (const char *path)
+{
+  register const struct conf *c;
+  size_t clen;
+  long int value;
+  char *cvalue;
+  for (c = vars; c->name != NULL; ++c) {
+    printf("%-35s", c->name);
+    switch (c->call) {
+      case PATHCONF:
+        value = pathconf (path, c->call_name);
+        if (value != -1) {
+          printf("%ld", value);
+        }
+        printf("\n");
+        break;
+      case SYSCONF:
+        value = sysconf (c->call_name);
+        if (value == -1l) {
+          if (c->call_name == _SC_UINT_MAX
+            || c->call_name == _SC_ULONG_MAX)
+            printf ("%lu", value);
+        }
+        else {
+          printf ("%ld", value);
+        }
+        printf ("\n");
+        break;
+      case CONFSTR:
+        clen = confstr (c->call_name, (char *) NULL, 0);
+        cvalue = (char *) malloc (clen);
+        if (cvalue == NULL)
+          error (3, 0, _("memory exhausted"));
+        if (confstr (c->call_name, cvalue, clen) != clen)
+          error (3, errno, "confstr");
+        printf ("%.*s\n", (int) clen, cvalue);
+        break;
+    }
+  }
+  exit (0);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -752,16 +1007,109 @@ main (int argc, char *argv[])
 Copyright (C) %s Free Software Foundation, Inc.\n\
 This is free software; see the source for copying conditions.  There is NO\n\
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2001");
+"), "2006");
       fprintf (stderr, gettext ("Written by %s.\n"), "Roland McGrath");
       return 0;
     }
 
+  const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
+  size_t getconf_dirlen = strlen (getconf_dir);
+
+  const char *spec = NULL;
+  char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
+  char *argv0 = argv[0];
+  if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
+    {
+      if (argv[1][2] == '\0')
+       {
+         if (argc < 3)
+           usage ();
+
+         spec = argv[2];
+         argv += 2;
+         argc -= 2;
+       }
+      else
+       {
+         spec = &argv[1][2];
+         argv += 1;
+         argc += 1;
+       }
+    }
+  else
+    {
+      char default_name[getconf_dirlen + sizeof "/default"];
+      memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
+             "/default", sizeof "/default");
+      int len = readlink (default_name, buf, sizeof buf - 1);
+      if (len > 0)
+       {
+         buf[len] = '\0';
+         spec = buf;
+       }
+    }
+
+  /* Check for the specifications we know.  */
+  if (spec != NULL)
+    {
+      int i;
+      for (i = 0; i < nspecs; ++i)
+       if (strcmp (spec, specs[i].name) == 0)
+         break;
+
+      if (i == nspecs)
+       error (2, 0, _("unknown specification \"%s\""), spec);
+
+      switch (specs[i].num)
+       {
+#ifndef _POSIX_V6_ILP32_OFF32
+         case _SC_V6_ILP32_OFF32:
+#endif
+#ifndef _POSIX_V6_ILP32_OFFBIG
+         case _SC_V6_ILP32_OFFBIG:
+#endif
+#ifndef _POSIX_V6_LP64_OFF64
+         case _SC_V6_LP64_OFF64:
+#endif
+#ifndef _POSIX_V6_LPBIG_OFFBIG
+         case _SC_V6_LPBIG_OFFBIG:
+#endif
+           {
+             const char *args[argc + 3];
+             size_t spec_len = strlen (spec);
+             char getconf_name[getconf_dirlen + 1 + spec_len + 1];
+             memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
+                                       getconf_dirlen),
+                              "/", 1), spec, spec_len + 1);
+             args[0] = argv0;
+             args[1] = "-v";
+             args[2] = spec;
+             memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
+             execv (getconf_name, (char * const *) args);
+             error (4, errno, _("Couldn't execute %s"), getconf_name);
+           }
+         default:
+           break;
+       }
+    }
+
+  if (argc > 1 && strcmp (argv[1], "-a") == 0)
+    {
+      if (argc == 2)
+       print_all ("/");
+      else if (argc == 3)
+       print_all (argv[2]);
+      else
+       usage ();
+    }
+
   if (argc < 2 || argc > 3)
     usage ();
 
   for (c = vars; c->name != NULL; ++c)
-    if (!strcmp (c->name, argv[1]))
+    if (strcmp (c->name, argv[1]) == 0
+       || (strncmp (c->name, "_POSIX_", 7) == 0
+           && strcmp (c->name + 7, argv[1]) == 0))
       {
        long int value;
        size_t clen;