mirror of
https://sourceware.org/git/glibc.git
synced 2026-01-06 11:51:29 +03:00
Update.
* include/time.h: Define CLOCK_IDFIELD_SIZE. * sysdeps/posix/clock_getres.c: Recognize thread CPU clock IDs. * sysdeps/unix/clock_gettime.c: Likewise. * sysdeps/unix/clock_settime.c: Likewise. * sysdeps/unix/clock_nanosleep.c (CPUCLOCK_P): Adjust for new clock id for thread CPU clocks.
This commit is contained in:
@@ -32,7 +32,8 @@ static hp_timing_t freq;
|
||||
|
||||
|
||||
/* This function is defined in the thread library. */
|
||||
extern int __pthread_clock_gettime (hp_timing_t freq, struct timespec *tp)
|
||||
extern int __pthread_clock_gettime (clockid_t clock_id, hp_timing_t freq,
|
||||
struct timespec *tp)
|
||||
__attribute__ ((__weak__));
|
||||
#endif
|
||||
|
||||
@@ -64,9 +65,19 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
#if HP_TIMING_AVAIL
|
||||
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
|
||||
!= CLOCK_THREAD_CPUTIME_ID)
|
||||
#endif
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
break;
|
||||
}
|
||||
|
||||
#if HP_TIMING_AVAIL
|
||||
/* FALLTHROUGH. */
|
||||
case CLOCK_PROCESS_CPUTIME_ID:
|
||||
case CLOCK_THREAD_CPUTIME_ID:
|
||||
{
|
||||
hp_timing_t tsc;
|
||||
|
||||
@@ -82,10 +93,10 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
|
||||
break;
|
||||
}
|
||||
|
||||
if (clock_id == CLOCK_THREAD_CPUTIME_ID
|
||||
if (clock_id != CLOCK_PROCESS_CPUTIME_ID
|
||||
&& __pthread_clock_gettime != NULL)
|
||||
{
|
||||
retval = __pthread_clock_gettime (freq, tp);
|
||||
retval = __pthread_clock_gettime (clock_id, freq, tp);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -106,10 +117,6 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
__set_errno (EINVAL);
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
Reference in New Issue
Block a user