summaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-12-03 11:20:54 +0000
committerJakub Jelinek <jakub@redhat.com>2004-12-03 11:20:54 +0000
commit53bfe35486b304ce77695040ccf8294dae36d45f (patch)
tree48049877c51e7dfcadb180755a9778d0e4a8d40e /posix
parentd5321ea34dec8d3e5c9fbb2801e7039e2e675d91 (diff)
downloadglibc-53bfe35486b304ce77695040ccf8294dae36d45f.tar.gz
* posix/tst-regex.c: Use defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
conditionals instead of defined _POSIX_CPUTIME. (main): If _POSIX_CPUTIME == 0, call sysconf to see if CPUTIME option is available. * posix/tst-regex.c2: Use defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0 conditionals instead of defined _POSIX_CPUTIME. (do_test): If _POSIX_CPUTIME == 0, call sysconf to see if CPUTIME option is available. * sysdeps/posix/sysconf.c (__sysconf): If _POSIX_CPUTIME resp. _POSIX_THREAD_CPUTIME is defined to 0, return -1 for the corresponding _SC_ argument. nptl/ * sysdeps/unix/sysv/linux/bits/posix_opt.h (_POSIX_CPUTIME, _POSIX_THREAD_CPUTIME): Define to 0. * sysdeps/pthread/timer_create.c (timer_create): Remove unused code handling CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID. * sysdeps/pthread/timer_routines.c (__timer_signal_thread_pclk, __timer_signal_thread_tclk): Remove. (init_module): Remove their initialization. (thread_cleanup): Remove their cleanup assertions. * sysdeps/pthread/posix-timer.h (__timer_signal_thread_pclk, __timer_signal_thread_tclk): Remove. * sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Removed. * sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h: Removed. * sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h: Removed. linuxthreads/ * sysdeps/unix/sysv/linux/bits/posix_opt.h (_POSIX_CPUTIME, _POSIX_THREAD_CPUTIME): Define to 0. * sysdeps/pthread/timer_create.c (timer_create): Remove unused code handling CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID. * sysdeps/pthread/timer_routines.c (__timer_signal_thread_pclk, __timer_signal_thread_tclk): Remove. (init_module): Remove their initialization. (thread_cleanup): Remove their cleanup assertions. * sysdeps/pthread/posix-timer.h (__timer_signal_thread_pclk, __timer_signal_thread_tclk): Remove. * sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Removed. * sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h: Removed. * sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h: Removed.
Diffstat (limited to 'posix')
-rw-r--r--posix/tst-regex.c25
-rw-r--r--posix/tst-regex2.c17
2 files changed, 26 insertions, 16 deletions
diff --git a/posix/tst-regex.c b/posix/tst-regex.c
index 53960a3d9a..6a71e1239a 100644
--- a/posix/tst-regex.c
+++ b/posix/tst-regex.c
@@ -37,7 +37,7 @@
#include <regex.h>
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
static clockid_t cl;
static int use_clock;
#endif
@@ -118,9 +118,14 @@ main (int argc, char *argv[])
if (inlen != 0)
error (EXIT_FAILURE, errno, "cannot convert buffer");
-#ifdef _POSIX_CPUTIME
- /* See whether we can use the CPU clock. */
- use_clock = clock_getcpuclockid (0, &cl) == 0;
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
+# if _POSIX_CPUTIME == 0
+ if (sysconf (_SC_CPUTIME) < 0)
+ use_clock = 0;
+ else
+# endif
+ /* See whether we can use the CPU clock. */
+ use_clock = clock_getcpuclockid (0, &cl) == 0;
#endif
#ifdef DEBUG
@@ -202,7 +207,7 @@ static int
run_test (const char *expr, const char *mem, size_t memlen, int icase,
int expected)
{
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
struct timespec start;
struct timespec finish;
#endif
@@ -211,7 +216,7 @@ run_test (const char *expr, const char *mem, size_t memlen, int icase,
size_t offset;
int cnt;
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
if (use_clock && !timing)
use_clock = clock_gettime (cl, &start) == 0;
#endif
@@ -260,7 +265,7 @@ run_test (const char *expr, const char *mem, size_t memlen, int icase,
regfree (&re);
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
if (use_clock && !timing)
{
use_clock = clock_gettime (cl, &finish) == 0;
@@ -345,7 +350,7 @@ static int
run_test_backwards (const char *expr, const char *mem, size_t memlen,
int icase, int expected)
{
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
struct timespec start;
struct timespec finish;
#endif
@@ -354,7 +359,7 @@ run_test_backwards (const char *expr, const char *mem, size_t memlen,
size_t offset;
int cnt;
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
if (use_clock && !timing)
use_clock = clock_gettime (cl, &start) == 0;
#endif
@@ -406,7 +411,7 @@ run_test_backwards (const char *expr, const char *mem, size_t memlen,
regfree (&re);
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
if (use_clock && !timing)
{
use_clock = clock_gettime (cl, &finish) == 0;
diff --git a/posix/tst-regex2.c b/posix/tst-regex2.c
index a107f73ba4..0d82c2acdd 100644
--- a/posix/tst-regex2.c
+++ b/posix/tst-regex2.c
@@ -8,7 +8,7 @@
#include <time.h>
#include <unistd.h>
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
static clockid_t cl;
static int use_clock;
#endif
@@ -16,9 +16,14 @@ static int use_clock;
static int
do_test (void)
{
-#ifdef _POSIX_CPUTIME
- /* See whether we can use the CPU clock. */
- use_clock = clock_getcpuclockid (0, &cl) == 0;
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
+# if _POSIX_CPUTIME == 0
+ if (sysconf (_SC_CPUTIME) < 0)
+ use_clock = 0;
+ else
+# endif
+ /* See whether we can use the CPU clock. */
+ use_clock = clock_getcpuclockid (0, &cl) == 0;
#endif
static const char *pat[] = {
@@ -112,7 +117,7 @@ do_test (void)
rpbuf.no_sub = 1;
}
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
struct timespec start, stop;
if (use_clock)
use_clock = clock_gettime (cl, &start) == 0;
@@ -211,7 +216,7 @@ do_test (void)
}
}
-#ifdef _POSIX_CPUTIME
+#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
if (use_clock)
use_clock = clock_gettime (cl, &stop) == 0;
if (use_clock)