mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user