summaryrefslogtreecommitdiff
path: root/linuxthreads/tst-clock1.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 /linuxthreads/tst-clock1.c
parent708bfb9a90fca1ecf14668e7455d747d7e8b152c (diff)
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 'linuxthreads/tst-clock1.c')
-rw-r--r--linuxthreads/tst-clock1.c12
1 files changed, 10 insertions, 2 deletions
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 <unistd.h>
-#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)
{