aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2006-03-06 02:51:01 +0000
committerRoland McGrath <roland@gnu.org>2006-03-06 02:51:01 +0000
commit182ed12e71051879279121779ff068825bcd55b5 (patch)
treeae0adb5f4a01ebb2f9c15af52a009ff56751eec6
parent7ccbe1a1339471b3b538f76d83de454f1d78f608 (diff)
downloadglibc-182ed12e71051879279121779ff068825bcd55b5.zip
glibc-182ed12e71051879279121779ff068825bcd55b5.tar.gz
glibc-182ed12e71051879279121779ff068825bcd55b5.tar.bz2
* sysdeps/posix/sysconf.c (__sysconf): Use #if _POSIX_FOO > 0
rather than #ifdef _POSIX_FOO for options. We should return -1 at runtime for an option defined to 0 at compile time. * sysdeps/mach/hurd/bits/posix_opt.h: Define many missing options, many to -1 or 0. 2006-03-05 Roland McGrath <roland@redhat.com> * sysdeps/unix/sysv/linux/sysconf.c (__sysconf) [__NR_clock_getres || HP_TIMING_AVAIL]: Handle _SC_CPUTIME, _SC_THREAD_CPUTIME.
-rw-r--r--ChangeLog15
-rw-r--r--sysdeps/mach/hurd/bits/posix_opt.h108
-rw-r--r--sysdeps/posix/sysconf.c160
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c24
4 files changed, 215 insertions, 92 deletions
diff --git a/ChangeLog b/ChangeLog
index 9613703..0130676 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2006-03-05 Roland McGrath <roland@frob.com>
+
+ * sysdeps/posix/sysconf.c (__sysconf): Use #if _POSIX_FOO > 0
+ rather than #ifdef _POSIX_FOO for options. We should return -1
+ at runtime for an option defined to 0 at compile time.
+
+ * sysdeps/mach/hurd/bits/posix_opt.h: Define many missing options,
+ many to -1 or 0.
+
+2006-03-05 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sysconf.c (__sysconf)
+ [__NR_clock_getres || HP_TIMING_AVAIL]: Handle _SC_CPUTIME,
+ _SC_THREAD_CPUTIME.
+
2006-03-05 David S. Miller <davem@sunset.davemloft.net>
* sysdeps/sparc/sparc32/dl-trampoline.S: Add CFI markings.
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 326bebf..6747bc2 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
@@ -1,5 +1,5 @@
/* Define POSIX options for GNU/Hurd.
- Copyright (C) 1998,2000,2001,2002 Free Software Foundation, Inc.
+ Copyright (C) 1998,2000,2001,2002,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
@@ -31,13 +31,6 @@
/* Processes have a saved set-user-ID and a saved set-group-ID. */
#define _POSIX_SAVED_IDS 1
-#if 0 /* XXX implement aio_* */
-/* Asynchronous I/O is supported. */
-#define _POSIX_ASYNCHRONOUS_IO 1
-/* Alternative name for Unix98. */
-#define _LFS_ASYNCHRONOUS_IO _POSIX_ASYNCHRONOUS_IO
-#endif
-
/* Synchronizing file data is supported, but msync is missing. */
#undef _POSIX_SYNCHRONIZED_IO
@@ -47,15 +40,15 @@
/* Mapping of files to memory is supported. */
#define _POSIX_MAPPED_FILES 200112L
+/* Locking of all memory could be supported in future. */
+#define _POSIX_MEMLOCK 0
+
/* Locking of ranges of memory is supported. */
#define _POSIX_MEMLOCK_RANGE 200112L
/* Setting of memory protections is supported. */
#define _POSIX_MEMORY_PROTECTION 200112L
-/* POSIX.4 shared memory objects are supported (using regular files). */
-#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_MAPPED_FILES
-
/* Elements of the `c_cc' member of `struct termios' structure
can be disabled by using the value _POSIX_VDISABLE. */
#define _POSIX_VDISABLE ((unsigned char) -1)
@@ -67,13 +60,106 @@
#undef _POSIX_NO_TRUNC /* Overlong file names get error? */
#undef _POSIX_SYNC_IO /* File supports O_SYNC et al? */
+
+/* We do not have the POSIX threads interface. */
+#define _POSIX_THREADS -1
+
+/* We have the reentrant functions described in POSIX. */
+#define _POSIX_REENTRANT_FUNCTIONS 1
+#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
+
+/* These are all things that won't be supported when _POSIX_THREADS is not. */
+#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
+#define _POSIX_THREAD_ATTR_STACKSIZE -1
+#define _POSIX_THREAD_ATTR_STACKADDR -1
+#define _POSIX_SEMAPHORES -1
+
+/* Real-time signals are not yet supported. */
+#define _POSIX_REALTIME_SIGNALS -1
+
+/* Asynchronous I/O might supported with the existing ABI. */
+#define _POSIX_ASYNCHRONOUS_IO 0
+/* Alternative name for Unix98. */
+#define _LFS_ASYNCHRONOUS_IO _POSIX_ASYNCHRONOUS_IO
+
+/* The LFS support in asynchronous I/O is also available. */
+#define _LFS64_ASYNCHRONOUS_IO _POSIX_ASYNCHRONOUS_IO
+
+/* The rest of the LFS is also available. */
+#define _LFS_LARGEFILE 1
+#define _LFS64_LARGEFILE 1
+#define _LFS64_STDIO 1
+
+/* POSIX.4 shared memory objects are supported (using regular files). */
+#define _POSIX_SHARED_MEMORY_OBJECTS _POSIX_MAPPED_FILES
+
+/* CPU-time clocks support needs to be checked at runtime. */
+#define _POSIX_CPUTIME 0
+
+/* Clock support in threads must be also checked at runtime. */
+#define _POSIX_THREAD_CPUTIME 0
+
/* GNU libc provides regular expression handling. */
#define _POSIX_REGEXP 1
+/* Reader/Writer locks are not available. */
+#define _POSIX_READER_WRITER_LOCKS -1
+
/* We have a POSIX shell. */
#define _POSIX_SHELL 1
+/* We cannot support the Timeouts option without _POSIX_THREADS. */
+#define _POSIX_TIMEOUTS -1
+
/* The `spawn' function family is supported. */
#define _POSIX_SPAWN 200112L
+/* We do not have POSIX timers, but could in future without ABI change. */
+#define _POSIX_TIMERS 0
+
+/* The barrier functions are not available. */
+#define _POSIX_BARRIERS -1
+
+/* POSIX message queues could be available in future. */
+#define _POSIX_MESSAGE_PASSING 0
+
+/* Thread process-shared synchronization is not supported. */
+#define _POSIX_THREAD_PROCESS_SHARED -1
+
+/* The monotonic clock might be available. */
+#define _POSIX_MONOTONIC_CLOCK 0
+
+/* The clock selection interfaces are available. */
+#define _POSIX_CLOCK_SELECTION 200112L
+
+/* Advisory information interfaces could be available in future. */
+#define _POSIX_ADVISORY_INFO 0
+
+/* IPv6 support is available. */
+#define _POSIX_IPV6 200112L
+
+/* Raw socket support is available. */
+#define _POSIX_RAW_SOCKETS 200112L
+
+/* We have at least one terminal. */
+#define _POSIX2_CHAR_TERM 200112L
+
+/* Neither process nor thread sporadic server interfaces is available. */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER -1
+
+/* trace.h is not available. */
+#define _POSIX_TRACE -1
+#define _POSIX_TRACE_EVENT_FILTER -1
+#define _POSIX_TRACE_INHERIT -1
+#define _POSIX_TRACE_LOG -1
+
+/* Typed memory objects are not available. */
+#define _POSIX_TYPED_MEMORY_OBJECTS -1
+
+/* No support for priority inheritance or protection so far. */
+#define _POSIX_THREAD_PRIO_INHERIT -1
+#define _POSIX_THREAD_PRIO_PROTECT -1
+
+
#endif /* bits/posix_opt.h */
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index cb5137c..5a35592 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -95,112 +95,112 @@ __sysconf (name)
return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
case _SC_JOB_CONTROL:
-#ifdef _POSIX_JOB_CONTROL
- return 1;
+#if _POSIX_JOB_CONTROL > 0
+ return _POSIX_JOB_CONTROL;
#else
return -1;
#endif
case _SC_SAVED_IDS:
-#ifdef _POSIX_SAVED_IDS
+#if _POSIX_SAVED_IDS > 0
return 1;
#else
return -1;
#endif
case _SC_REALTIME_SIGNALS:
-#ifdef _POSIX_REALTIME_SIGNALS
+#if _POSIX_REALTIME_SIGNALS > 0
return _POSIX_REALTIME_SIGNALS;
#else
return -1;
#endif
case _SC_PRIORITY_SCHEDULING:
-#ifdef _POSIX_PRIORITY_SCHEDULING
+#if _POSIX_PRIORITY_SCHEDULING > 0
return _POSIX_PRIORITY_SCHEDULING;
#else
return -1;
#endif
case _SC_TIMERS:
-#ifdef _POSIX_TIMERS
+#if _POSIX_TIMERS > 0
return _POSIX_TIMERS;
#else
return -1;
#endif
case _SC_ASYNCHRONOUS_IO:
-#ifdef _POSIX_ASYNCHRONOUS_IO
+#if _POSIX_ASYNCHRONOUS_IO > 0
return _POSIX_ASYNCHRONOUS_IO;
#else
return -1;
#endif
case _SC_PRIORITIZED_IO:
-#ifdef _POSIX_PRIORITIZED_IO
+#if _POSIX_PRIORITIZED_IO > 0
return _POSIX_PRIORITIZED_IO;
#else
return -1;
#endif
case _SC_SYNCHRONIZED_IO:
-#ifdef _POSIX_SYNCHRONIZED_IO
+#if _POSIX_SYNCHRONIZED_IO > 0
return _POSIX_SYNCHRONIZED_IO;
#else
return -1;
#endif
case _SC_FSYNC:
-#ifdef _POSIX_FSYNC
+#if _POSIX_FSYNC > 0
return _POSIX_FSYNC;
#else
return -1;
#endif
case _SC_MAPPED_FILES:
-#ifdef _POSIX_MAPPED_FILES
+#if _POSIX_MAPPED_FILES > 0
return _POSIX_MAPPED_FILES;
#else
return -1;
#endif
case _SC_MEMLOCK:
-#ifdef _POSIX_MEMLOCK
+#if _POSIX_MEMLOCK > 0
return _POSIX_MEMLOCK;
#else
return -1;
#endif
case _SC_MEMLOCK_RANGE:
-#ifdef _POSIX_MEMLOCK_RANGE
+#if _POSIX_MEMLOCK_RANGE > 0
return _POSIX_MEMLOCK_RANGE;
#else
return -1;
#endif
case _SC_MEMORY_PROTECTION:
-#ifdef _POSIX_MEMORY_PROTECTION
+#if _POSIX_MEMORY_PROTECTION > 0
return _POSIX_MEMORY_PROTECTION;
#else
return -1;
#endif
case _SC_MESSAGE_PASSING:
-#ifdef _POSIX_MESSAGE_PASSING
+#if _POSIX_MESSAGE_PASSING > 0
return _POSIX_MESSAGE_PASSING;
#else
return -1;
#endif
case _SC_SEMAPHORES:
-#ifdef _POSIX_SEMAPHORES
+#if _POSIX_SEMAPHORES > 0
return _POSIX_SEMAPHORES;
#else
return -1;
#endif
case _SC_SHARED_MEMORY_OBJECTS:
-#ifdef _POSIX_SHARED_MEMORY_OBJECTS
+#if _POSIX_SHARED_MEMORY_OBJECTS > 0
return _POSIX_SHARED_MEMORY_OBJECTS;
#else
return -1;
@@ -353,49 +353,49 @@ __sysconf (name)
#endif
case _SC_PII:
-#ifdef _POSIX_PII
+#if _POSIX_PII > 0
return 1;
#else
return -1;
#endif
case _SC_PII_XTI:
-#ifdef _POSIX_PII_XTI
+#if _POSIX_PII_XTI > 0
return 1;
#else
return -1;
#endif
case _SC_PII_SOCKET:
-#ifdef _POSIX_PII_SOCKET
+#if _POSIX_PII_SOCKET > 0
return 1;
#else
return -1;
#endif
case _SC_PII_INTERNET:
-#ifdef _POSIX_PII_INTERNET
+#if _POSIX_PII_INTERNET > 0
return 1;
#else
return -1;
#endif
case _SC_PII_OSI:
-#ifdef _POSIX_PII_OSI
+#if _POSIX_PII_OSI > 0
return 1;
#else
return -1;
#endif
case _SC_POLL:
-#ifdef _POSIX_POLL
+#if _POSIX_POLL > 0
return 1;
#else
return -1;
#endif
case _SC_SELECT:
-#ifdef _POSIX_SELECT
+#if _POSIX_SELECT > 0
return 1;
#else
return -1;
@@ -410,35 +410,35 @@ __sysconf (name)
#endif
case _SC_PII_INTERNET_STREAM:
-#ifdef _POSIX_PII_INTERNET_STREAM
+#if _POSIX_PII_INTERNET_STREAM > 0
return 1;
#else
return -1;
#endif
case _SC_PII_INTERNET_DGRAM:
-#ifdef _POSIX_PII_INTERNET_DGRAM
+#if _POSIX_PII_INTERNET_DGRAM > 0
return 1;
#else
return -1;
#endif
case _SC_PII_OSI_COTS:
-#ifdef _POSIX_PII_OSI_COTS
+#if _POSIX_PII_OSI_COTS > 0
return 1;
#else
return -1;
#endif
case _SC_PII_OSI_CLTS:
-#ifdef _POSIX_PII_OSI_CLTS
+#if _POSIX_PII_OSI_CLTS > 0
return 1;
#else
return -1;
#endif
case _SC_PII_OSI_M:
-#ifdef _POSIX_PII_OSI_M
+#if _POSIX_PII_OSI_M > 0
return 1;
#else
return -1;
@@ -519,14 +519,14 @@ __sysconf (name)
/* POSIX 1003.1c (POSIX Threads). */
case _SC_THREADS:
-#ifdef _POSIX_THREADS
+#if _POSIX_THREADS > 0
return _POSIX_THREADS;
#else
return -1;
#endif
case _SC_THREAD_SAFE_FUNCTIONS:
-#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
+#if _POSIX_THREAD_SAFE_FUNCTIONS > 0
return _POSIX_THREAD_SAFE_FUNCTIONS;
#else
return -1;
@@ -553,7 +553,7 @@ __sysconf (name)
#endif
case _SC_THREAD_DESTRUCTOR_ITERATIONS:
-#ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
+#if _POSIX_THREAD_DESTRUCTOR_ITERATIONS > 0
return _POSIX_THREAD_DESTRUCTOR_ITERATIONS;
#else
return -1;
@@ -581,42 +581,42 @@ __sysconf (name)
#endif
case _SC_THREAD_ATTR_STACKADDR:
-#ifdef _POSIX_THREAD_ATTR_STACKADDR
+#if _POSIX_THREAD_ATTR_STACKADDR > 0
return _POSIX_THREAD_ATTR_STACKADDR;
#else
return -1;
#endif
case _SC_THREAD_ATTR_STACKSIZE:
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
+#if _POSIX_THREAD_ATTR_STACKSIZE > 0
return _POSIX_THREAD_ATTR_STACKSIZE;
#else
return -1;
#endif
case _SC_THREAD_PRIORITY_SCHEDULING:
-#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
return _POSIX_THREAD_PRIORITY_SCHEDULING;
#else
return -1;
#endif
case _SC_THREAD_PRIO_INHERIT:
-#ifdef _POSIX_THREAD_PRIO_INHERIT
+#if _POSIX_THREAD_PRIO_INHERIT > 0
return _POSIX_THREAD_PRIO_INHERIT;
#else
return -1;
#endif
case _SC_THREAD_PRIO_PROTECT:
-#ifdef _POSIX_THREAD_PRIO_PROTECT
+#if _POSIX_THREAD_PRIO_PROTECT > 0
return _POSIX_THREAD_PRIO_PROTECT;
#else
return -1;
#endif
case _SC_THREAD_PROCESS_SHARED:
-#ifdef _POSIX_THREAD_PROCESS_SHARED
+#if _POSIX_THREAD_PROCESS_SHARED > 0
return _POSIX_THREAD_PROCESS_SHARED;
#else
return -1;
@@ -816,25 +816,25 @@ __sysconf (name)
#endif
case _SC_V6_ILP32_OFF32:
-#ifdef _POSIX_V6_ILP32_OFF32
+#if _POSIX_V6_ILP32_OFF32 > 0
return _POSIX_V6_ILP32_OFF32;
#else
return __sysconf_check_spec ("ILP32_OFF32");
#endif
case _SC_V6_ILP32_OFFBIG:
-#ifdef _POSIX_V6_ILP32_OFFBIG
+#if _POSIX_V6_ILP32_OFFBIG > 0
return _POSIX_V6_ILP32_OFFBIG;
#else
return __sysconf_check_spec ("ILP32_OFFBIG");
#endif
case _SC_V6_LP64_OFF64:
-#ifdef _POSIX_V6_LP64_OFF64
+#if _POSIX_V6_LP64_OFF64 > 0
return _POSIX_V6_LP64_OFF64;
#else
return __sysconf_check_spec ("LP64_OFF64");
#endif
case _SC_V6_LPBIG_OFFBIG:
-#ifdef _POSIX_V6_LPBIG_OFFBIG
+#if _POSIX_V6_LPBIG_OFFBIG > 0
return _POSIX_V6_LPBIG_OFFBIG;
#else
return __sysconf_check_spec ("LPBIG_OFFBIG");
@@ -857,40 +857,40 @@ __sysconf (name)
#endif
case _SC_ADVISORY_INFO:
-#ifdef _POSIX_ADVISORY_INFO
+#if _POSIX_ADVISORY_INFO > 0
return _POSIX_ADVISORY_INFO;
#else
return -1;
#endif
case _SC_BARRIERS:
-#ifdef _POSIX_BARRIERS
+#if _POSIX_BARRIERS > 0
return _POSIX_BARRIERS;
#else
return -1;
#endif
case _SC_BASE:
-#ifdef _POSIX_BASE
+#if _POSIX_BASE > 0
return _POSIX_BASE;
#else
return -1;
#endif
case _SC_C_LANG_SUPPORT:
-#ifdef _POSIX_C_LANG_SUPPORT
+#if _POSIX_C_LANG_SUPPORT > 0
return _POSIX_C_LANG_SUPPORT;
#else
return -1;
#endif
case _SC_C_LANG_SUPPORT_R:
-#ifdef _POSIX_C_LANG_SUPPORT_R
+#if _POSIX_C_LANG_SUPPORT_R > 0
return _POSIX_C_LANG_SUPPORT_R;
#else
return -1;
#endif
case _SC_CLOCK_SELECTION:
-#ifdef _POSIX_CLOCK_SELECTION
+#if _POSIX_CLOCK_SELECTION > 0
return _POSIX_CLOCK_SELECTION;
#else
return -1;
@@ -904,58 +904,58 @@ __sysconf (name)
#endif
case _SC_DEVICE_IO:
-#ifdef _POSIX_DEVICE_IO
+#if _POSIX_DEVICE_IO > 0
return _POSIX_DEVICE_IO;
#else
return -1;
#endif
case _SC_DEVICE_SPECIFIC:
-#ifdef _POSIX_DEVICE_SPCIFIC
+#if _POSIX_DEVICE_SPCIFIC > 0
return _POSIX_DEVICE_SPECIFIC;
#else
return -1;
#endif
case _SC_DEVICE_SPECIFIC_R:
-#ifdef _POSIX_DEVICE_SPCIFIC_R
+#if _POSIX_DEVICE_SPCIFIC_R > 0
return _POSIX_DEVICE_SPECIFIC_R;
#else
return -1;
#endif
case _SC_FD_MGMT:
-#ifdef _POSIX_FD_MGMT
+#if _POSIX_FD_MGMT > 0
return _POSIX_FD_MGMT;
#else
return -1;
#endif
case _SC_FIFO:
-#ifdef _POSIX_FIFO
+#if _POSIX_FIFO > 0
return _POSIX_FIFO;
#else
return -1;
#endif
case _SC_PIPE:
-#ifdef _POSIX_PIPE
+#if _POSIX_PIPE > 0
return _POSIX_PIPE;
#else
return -1;
#endif
case _SC_FILE_ATTRIBUTES:
-#ifdef _POSIX_FILE_ATTRIBUTES
+#if _POSIX_FILE_ATTRIBUTES > 0
return _POSIX_FILE_ATTRIBUTES;
#else
return -1;
#endif
case _SC_FILE_LOCKING:
-#ifdef _POSIX_FILE_LOCKING
+#if _POSIX_FILE_LOCKING > 0
return _POSIX_FILE_LOCKING;
#else
return -1;
#endif
case _SC_FILE_SYSTEM:
-#ifdef _POSIX_FILE_SYSTEM
+#if _POSIX_FILE_SYSTEM > 0
return _POSIX_FILE_SYSTEM;
#else
return -1;
@@ -969,53 +969,53 @@ __sysconf (name)
#endif
case _SC_MULTI_PROCESS:
-#ifdef _POSIX_MULTI_PROCESS
+#if _POSIX_MULTI_PROCESS > 0
return _POSIX_MULTI_PROCESS;
#else
return -1;
#endif
case _SC_SINGLE_PROCESS:
-#ifdef _POSIX_SINGLE_PROCESS
+#if _POSIX_SINGLE_PROCESS > 0
return _POSIX_SINGLE_PROCESS;
#else
return -1;
#endif
case _SC_NETWORKING:
-#ifdef _POSIX_NETWORKING
+#if _POSIX_NETWORKING > 0
return _POSIX_NETWORKING;
#else
return -1;
#endif
case _SC_READER_WRITER_LOCKS:
-#ifdef _POSIX_READER_WRITER_LOCKS
+#if _POSIX_READER_WRITER_LOCKS > 0
return _POSIX_READER_WRITER_LOCKS;
#else
return -1;
#endif
case _SC_SPIN_LOCKS:
-#ifdef _POSIX_SPIN_LOCKS
+#if _POSIX_SPIN_LOCKS > 0
return _POSIX_SPIN_LOCKS;
#else
return -1;
#endif
case _SC_REGEXP:
-#ifdef _POSIX_REGEXP
+#if _POSIX_REGEXP > 0
return _POSIX_REGEXP;
#else
return -1;
#endif
case _SC_REGEX_VERSION:
-#ifdef _POSIX_REGEX_VERSION
+#if _POSIX_REGEX_VERSION > 0
return _POSIX_REGEX_VERSION;
#else
return -1;
#endif
case _SC_SHELL:
-#ifdef _POSIX_SHELL
+#if _POSIX_SHELL > 0
return _POSIX_SHELL;
#else
return -1;
@@ -1029,33 +1029,33 @@ __sysconf (name)
#endif
case _SC_SPAWN:
-#ifdef _POSIX_SPAWN
+#if _POSIX_SPAWN > 0
return _POSIX_SPAWN;
#else
return -1;
#endif
case _SC_SPORADIC_SERVER:
-#ifdef _POSIX_SPORADIC_SERVER
+#if _POSIX_SPORADIC_SERVER > 0
return _POSIX_SPORADIC_SERVER;
#else
return -1;
#endif
case _SC_THREAD_SPORADIC_SERVER:
-#ifdef _POSIX_THREAD_SPORADIC_SERVER
+#if _POSIX_THREAD_SPORADIC_SERVER > 0
return _POSIX_THREAD_SPORADIC_SERVER;
#else
return -1;
#endif
case _SC_SYSTEM_DATABASE:
-#ifdef _POSIX_SYSTEM_DATABASE
+#if _POSIX_SYSTEM_DATABASE > 0
return _POSIX_SYSTEM_DATABASE;
#else
return -1;
#endif
case _SC_SYSTEM_DATABASE_R:
-#ifdef _POSIX_SYSTEM_DATABASE_R
+#if _POSIX_SYSTEM_DATABASE_R > 0
return _POSIX_SYSTEM_DATABASE_R;
#else
return -1;
@@ -1069,27 +1069,27 @@ __sysconf (name)
#endif
case _SC_TIMEOUTS:
-#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS > 0
return _POSIX_TIMEOUTS;
#else
return -1;
#endif
case _SC_TYPED_MEMORY_OBJECTS:
-#ifdef _POSIX_TYPED_MEMORY_OBJECTS
+#if _POSIX_TYPED_MEMORY_OBJECTS > 0
return _POSIX_TYPED_MEMORY_OBJECTS;
#else
return -1;
#endif
case _SC_USER_GROUPS:
-#ifdef _POSIX_USER_GROUPS
+#if _POSIX_USER_GROUPS > 0
return _POSIX_USER_GROUPS;
#else
return -1;
#endif
case _SC_USER_GROUPS_R:
-#ifdef _POSIX_USER_GROUPS_R
+#if _POSIX_USER_GROUPS_R > 0
return _POSIX_USER_GROUPS_R;
#else
return -1;
@@ -1154,25 +1154,25 @@ __sysconf (name)
#endif
case _SC_TRACE:
-#ifdef _POSIX_TRACE
+#if _POSIX_TRACE > 0
return _POSIX_TRACE;
#else
return -1;
#endif
case _SC_TRACE_EVENT_FILTER:
-#ifdef _POSIX_TRACE_EVENT_FILTER
+#if _POSIX_TRACE_EVENT_FILTER > 0
return _POSIX_TRACE_EVENT_FILTER;
#else
return -1;
#endif
case _SC_TRACE_INHERIT:
-#ifdef _POSIX_TRACE_INHERIT
+#if _POSIX_TRACE_INHERIT > 0
return _POSIX_TRACE_INHERIT;
#else
return -1;
#endif
case _SC_TRACE_LOG:
-#ifdef _POSIX_TRACE_LOG
+#if _POSIX_TRACE_LOG > 0
return _POSIX_TRACE_LOG;
#else
return -1;
@@ -1198,14 +1198,14 @@ __sysconf (name)
return 0;
case _SC_IPV6:
-#ifdef _POSIX_IPV6
+#if _POSIX_IPV6 > 0
return _POSIX_IPV6;
#else
return -1;
#endif
case _SC_RAW_SOCKETS:
-#ifdef _POSIX_RAW_SOCKETS
+#if _POSIX_RAW_SOCKETS > 0
return _POSIX_RAW_SOCKETS;
#else
return -1;
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index 3cf6aa7..f9f6f1b 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -1,5 +1,5 @@
/* Get file-specific information about a file. Linux version.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 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
@@ -48,6 +48,28 @@ __sysconf (int name)
}
#endif
+#if defined __NR_clock_getres || HP_TIMING_AVAIL
+ case _SC_CPUTIME:
+ case _SC_THREAD_CPUTIME:
+ {
+ /* If we have HP_TIMING, we will fall back on that if the system
+ call does not work, so we support it either way. */
+# if !HP_TIMING_AVAIL
+ /* Check using the clock_getres system call. */
+ struct timespec ts;
+ INTERNAL_SYSCALL_DECL (err);
+ int r = INTERNAL_SYSCALL (clock_getres, err, 2,
+ (name == _SC_CPUTIME
+ ? CLOCK_PROCESS_CPUTIME_ID
+ : CLOCK_THREAD_CPUTIME_ID),
+ &ts);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
+# endif
+ return _POSIX_VERSION;
+ }
+#endif
+
case _SC_NGROUPS_MAX:
/* Try to read the information from the /proc/sys/kernel/ngroups_max
file. */