From bf7c04cd5f4b3a7d3e3155b0035396e7f1037a13 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 10 Dec 2004 00:41:30 +0000 Subject: Update. 2004-12-01 Jakub Jelinek * 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. --- linuxthreads/tst-clock1.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'linuxthreads/tst-clock1.c') diff --git a/linuxthreads/tst-clock1.c b/linuxthreads/tst-clock1.c index 54f5041282..bca40956e2 100644 --- a/linuxthreads/tst-clock1.c +++ b/linuxthreads/tst-clock1.c @@ -25,7 +25,7 @@ #include -#if _POSIX_THREAD_CPUTIME +#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0 static pthread_barrier_t b2; static pthread_barrier_t bN; @@ -55,9 +55,17 @@ tf (void *arg) int do_test (void) { -#if _POSIX_THREAD_CPUTIME +#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0 # define N 10 +# if _POSIX_THREAD_CPUTIME == 0 + if (sysconf (_SC_THREAD_CPUTIME) < 0) + { + puts ("_POSIX_THREAD_CPUTIME option not available"); + return 0; + } +# endif + if (pthread_barrier_init (&b2, NULL, 2) != 0 || pthread_barrier_init (&bN, NULL, N + 1) != 0) { -- cgit 1.4.1