diff options
| author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-01-18 10:18:01 -0300 |
|---|---|---|
| committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-04-02 15:28:36 -0300 |
| commit | a4ed0471d71739928a0d0fa3258b3ff3b158e9b9 (patch) | |
| tree | db8118e3d4c787cdae80d343bb40bb7fc7ed2926 /sysdeps | |
| parent | a0698a5e92ceeed3409d28623b1d599da6bc887d (diff) | |
| download | glibc-a4ed0471d71739928a0d0fa3258b3ff3b158e9b9.tar.xz glibc-a4ed0471d71739928a0d0fa3258b3ff3b158e9b9.zip | |
Always define __USE_TIME_BITS64 when 64 bit time_t is used
It was raised on libc-help [1] that some Linux kernel interfaces expect
the libc to define __USE_TIME_BITS64 to indicate the time_t size for the
kABI. Different than defined by the initial y2038 design document [2],
the __USE_TIME_BITS64 is only defined for ABIs that support more than
one time_t size (by defining the _TIME_BITS for each module).
The 64 bit time_t redirects are now enabled using a different internal
define (__USE_TIME64_REDIRECTS). There is no expected change in semantic
or code generation.
Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, and
arm-linux-gnueabi
[1] https://sourceware.org/pipermail/libc-help/2024-January/006557.html
[2] https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'sysdeps')
44 files changed, 96 insertions, 110 deletions
diff --git a/sysdeps/generic/features-time64.h b/sysdeps/generic/features-time64.h deleted file mode 100644 index 4d38b8ba76..0000000000 --- a/sysdeps/generic/features-time64.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Features part to handle 64-bit time_t support. Generic version. - Copyright (C) 2021-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <https://www.gnu.org/licenses/>. */ - -/* The generic configuration only support _TIME_BITS=32. */ diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index 1607fdf29a..3d4f4a756c 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -223,7 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return); the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Make calling thread wait for termination of the thread TH, but only until TIMEOUT. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. @@ -796,7 +796,7 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) #ifdef __USE_XOPEN2K /* Wait until lock becomes available, or specified time passes. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -813,7 +813,7 @@ extern int __REDIRECT_NTHNL (pthread_mutex_timedlock, #endif #ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, clockid_t __clockid, const struct timespec *__restrict @@ -982,7 +982,7 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire read lock for RWLOCK or return after specified time. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -1000,7 +1000,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock, # endif # ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict @@ -1029,7 +1029,7 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire write lock for RWLOCK or return after specified time. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -1047,7 +1047,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock, # endif # ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict @@ -1141,7 +1141,7 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) @@ -1167,7 +1167,7 @@ extern int __REDIRECT (pthread_cond_timedwait, This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, __clockid_t __clock_id, diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h index c75ca4ce6d..8a09633699 100644 --- a/sysdeps/pthread/semaphore.h +++ b/sysdeps/pthread/semaphore.h @@ -59,7 +59,7 @@ extern int sem_wait (sem_t *__sem) __nonnull ((1)); This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int sem_timedwait (sem_t *__restrict __sem, const struct timespec *__restrict __abstime) __nonnull ((1, 2)); @@ -77,7 +77,7 @@ extern int __REDIRECT (sem_timedwait, #endif #ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int sem_clockwait (sem_t *__restrict __sem, clockid_t clock, const struct timespec *__restrict __abstime) diff --git a/sysdeps/pthread/threads.h b/sysdeps/pthread/threads.h index c5410b5c3a..7cade24e1f 100644 --- a/sysdeps/pthread/threads.h +++ b/sysdeps/pthread/threads.h @@ -90,7 +90,7 @@ extern thrd_t thrd_current (void); __TIME_POINT. The current thread may resume if receives a signal. In that case, if __REMAINING is not NULL, the remaining time is stored in the object pointed by it. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int thrd_sleep (const struct timespec *__time_point, struct timespec *__remaining); #else @@ -143,7 +143,7 @@ extern int mtx_lock (mtx_t *__mutex); /* Block the current thread until the mutex pointed by __MUTEX is unlocked or time pointed by __TIME_POINT is reached. In case the mutex is unlock, the current thread will not be blocked. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int mtx_timedlock (mtx_t *__restrict __mutex, const struct timespec *__restrict __time_point); #else @@ -194,7 +194,7 @@ extern int cnd_wait (cnd_t *__cond, mtx_t *__mutex); /* Block current thread on the condition variable until condition variable pointed by __COND is signaled or time pointed by __TIME_POINT is reached. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int cnd_timedwait (cnd_t *__restrict __cond, mtx_t *__restrict __mutex, const struct timespec *__restrict __time_point); diff --git a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h index 255feaa8cb..89534fea85 100644 --- a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h @@ -28,7 +28,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include <bits/struct_stat_time64_helper.h> #else __dev_t st_dev; /* Device. */ @@ -83,13 +83,13 @@ struct stat # else __ino64_t st_ino; /* File serial number. */ # endif -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include <bits/struct_stat_time64_helper.h> # else __dev_t st_dev; /* Device. */ @@ -125,7 +125,7 @@ struct stat64 unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif __ino64_t st_ino; /* File serial number. */ -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/bits/socket-constants.h b/sysdeps/unix/sysv/linux/bits/socket-constants.h index d997dbf594..b2102d3abf 100644 --- a/sysdeps/unix/sysv/linux/bits/socket-constants.h +++ b/sysdeps/unix/sysv/linux/bits/socket-constants.h @@ -64,7 +64,7 @@ # define SO_TIMESTAMPNS_NEW 64 # define SO_TIMESTAMPING_NEW 65 -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # define SO_RCVTIMEO SO_RCVTIMEO_NEW # define SO_SNDTIMEO SO_SNDTIMEO_NEW # define SO_TIMESTAMP SO_TIMESTAMP_NEW diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h index b70ba58a7d..cab4057971 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h +++ b/sysdeps/unix/sysv/linux/bits/time.h @@ -77,7 +77,7 @@ __BEGIN_DECLS /* Tune a POSIX clock. */ extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW __nonnull((2)); -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # if defined(__REDIRECT_NTH) extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id, struct timex *__utx), diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h index 398d8094f2..03ccde6d0a 100644 --- a/sysdeps/unix/sysv/linux/bits/timex.h +++ b/sysdeps/unix/sysv/linux/bits/timex.h @@ -25,7 +25,7 @@ struct timex { -# if defined __USE_TIME_BITS64 || (__TIMESIZE == 64 && __WORDSIZE == 32) +# if defined __USE_TIME64_REDIRECTS || (__TIMESIZE == 64 && __WORDSIZE == 32) unsigned int modes; /* mode selector */ int :32; /* pad */ long long offset; /* time offset (usec) */ diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h index fae50281c7..86296ca922 100644 --- a/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h +++ b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h @@ -26,7 +26,7 @@ The type `struct msg' is opaque. */ struct msqid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include <bits/types/struct_msqid64_ds_helper.h> #else struct ipc_perm msg_perm; /* structure describing operation permission */ diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h index 3c277ed1d8..2ac89b3ce4 100644 --- a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include <bits/types/struct_semid64_ds_helper.h> #else struct ipc_perm sem_perm; /* operation permission struct */ |
