1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

Define in_int32_t_range to check if the 64 bit time_t syscall should be used

Currently glibc uses in_time_t_range to detects time_t overflow,
and if it occurs fallbacks to 64 bit syscall version.

The function name is confusing because internally time_t might be
either 32 bits or 64 bits (depending on __TIMESIZE).

This patch refactors the in_time_t_range by replacing it with
in_int32_t_range for the case to check if the 64 bit time_t syscall
should be used.

The in_time_t range is used to detect overflow of the
syscall return value.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
YunQiang Su
2022-11-08 12:49:46 +08:00
committed by Adhemerval Zanella
parent 94628de778
commit a9acb7b39e
18 changed files with 31 additions and 23 deletions

View File

@@ -87,7 +87,7 @@ __futex_abstimed_wait_common (unsigned int* futex_word,
err = __futex_abstimed_wait_common64 (futex_word, expected, op, abstime,
private, cancel);
#else
bool need_time64 = abstime != NULL && !in_time_t_range (abstime->tv_sec);
bool need_time64 = abstime != NULL && !in_int32_t_range (abstime->tv_sec);
if (need_time64)
{
err = __futex_abstimed_wait_common64 (futex_word, expected, op, abstime,
@@ -162,7 +162,7 @@ __futex_lock_pi64 (int *futex_word, clockid_t clockid,
# ifdef __ASSUME_TIME64_SYSCALLS
err = INTERNAL_SYSCALL_CALL (futex_time64, futex_word, op_pi, 0, abstime);
# else
bool need_time64 = abstime != NULL && !in_time_t_range (abstime->tv_sec);
bool need_time64 = abstime != NULL && !in_int32_t_range (abstime->tv_sec);
if (need_time64)
err = INTERNAL_SYSCALL_CALL (futex_time64, futex_word, op_pi, 0, abstime);
else