aboutsummaryrefslogtreecommitdiff
path: root/posix/tst-regex2.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-10 00:41:30 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-10 00:41:30 +0000
commitbf7c04cd5f4b3a7d3e3155b0035396e7f1037a13 (patch)
treefca029f46efa5faba09dbbb5035ba8efa53878f7 /posix/tst-regex2.c
parent708bfb9a90fca1ecf14668e7455d747d7e8b152c (diff)
downloadglibc-bf7c04cd5f4b3a7d3e3155b0035396e7f1037a13.tar
glibc-bf7c04cd5f4b3a7d3e3155b0035396e7f1037a13.tar.gz
glibc-bf7c04cd5f4b3a7d3e3155b0035396e7f1037a13.tar.bz2
glibc-bf7c04cd5f4b3a7d3e3155b0035396e7f1037a13.zip
Update.
2004-12-01 Jakub Jelinek <jakub@redhat.com> * 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.
Diffstat (limited to 'posix/tst-regex2.c')
-rw-r--r--posix/tst-regex2.c17
1 files changed, 11 insertions, 6 deletions
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)