From a4ed0471d71739928a0d0fa3258b3ff3b158e9b9 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Thu, 18 Jan 2024 10:18:01 -0300 Subject: 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 --- io/bits/poll2.h | 2 +- io/fcntl.h | 4 ++-- io/fts.h | 6 +++--- io/ftw.h | 12 ++++++------ io/sys/poll.h | 2 +- io/sys/stat.h | 16 ++++++++-------- io/utime.h | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'io') diff --git a/io/bits/poll2.h b/io/bits/poll2.h index 24ec1056eb..ca9d58badd 100644 --- a/io/bits/poll2.h +++ b/io/bits/poll2.h @@ -48,7 +48,7 @@ poll (__fortify_clang_overload_arg (struct pollfd *, ,__fds), nfds_t __nfds, #ifdef __USE_GNU -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS extern int __REDIRECT (__ppoll64_alias, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss), __ppoll64); diff --git a/io/fcntl.h b/io/fcntl.h index 38aa12d7f2..f157991782 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -172,7 +172,7 @@ typedef __pid_t pid_t; This function is a cancellation point and therefore not marked with __THROW. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS # ifndef __USE_FILE_OFFSET64 extern int fcntl (int __fd, int __cmd, ...); # else @@ -185,7 +185,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); # ifdef __USE_LARGEFILE64 extern int fcntl64 (int __fd, int __cmd, ...); # endif -#else /* __USE_TIME_BITS64 */ +#else /* __USE_TIME64_REDIRECTS */ # ifdef __REDIRECT extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...), __fcntl_time64); diff --git a/io/fts.h b/io/fts.h index 61f95bb441..97a031ebbd 100644 --- a/io/fts.h +++ b/io/fts.h @@ -187,7 +187,7 @@ FTSENT *fts_read (FTS *); int fts_set (FTS *, FTSENT *, int) __THROW; #else # ifdef __REDIRECT -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children); int __REDIRECT (fts_close, (FTS *), fts64_close); FTS *__REDIRECT (fts_open, (char * const *, int, @@ -206,7 +206,7 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), __fts64_set_time64); # endif # else -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS # define fts_children fts64_children # define fts_close fts64_close # define fts_open fts64_open @@ -217,7 +217,7 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), # endif #endif #ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS FTSENT64 *fts64_children (FTS64 *, int); int fts64_close (FTS64 *); FTS64 *fts64_open (char * const *, int, diff --git a/io/ftw.h b/io/ftw.h index e4d1b84d53..39cf595b27 100644 --- a/io/ftw.h +++ b/io/ftw.h @@ -137,7 +137,7 @@ extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors) __nonnull ((1, 2)); #else # ifdef __REDIRECT -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, int __descriptors), ftw64) __nonnull ((1, 2)); # else @@ -146,7 +146,7 @@ extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, __nonnull ((1, 2)); # endif # else -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS # define ftw ftw64 # else # define ftw __ftw64_time64 @@ -154,7 +154,7 @@ extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, # endif #endif #ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int ftw64 (const char *__dir, __ftw64_func_t __func, int __descriptors) __nonnull ((1, 2)); # else @@ -180,7 +180,7 @@ extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # else # ifdef __REDIRECT -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag), nftw64) __nonnull ((1, 2)); @@ -190,7 +190,7 @@ extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, __nonnull ((1, 2)); # endif # else -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS # define nftw nftw64 # else # define nftw __nftw64_time64 @@ -198,7 +198,7 @@ extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, # endif # endif # ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int nftw64 (const char *__dir, __nftw64_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # else diff --git a/io/sys/poll.h b/io/sys/poll.h index 7858fad6b9..c324ff5dad 100644 --- a/io/sys/poll.h +++ b/io/sys/poll.h @@ -66,7 +66,7 @@ extern int ppoll (struct pollfd *__fds, nfds_t __nfds, const __sigset_t *__ss) __fortified_attr_access (__write_only__, 1, 2); -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, diff --git a/io/sys/stat.h b/io/sys/stat.h index 1fa6d6e62e..3b4ba80132 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -209,7 +209,7 @@ extern int stat (const char *__restrict __file, that file descriptor FD is open on and put them in BUF. */ extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (stat, (const char *__restrict __file, struct stat *__restrict __buf), @@ -236,7 +236,7 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) # endif #endif #ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int stat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); @@ -265,7 +265,7 @@ extern int fstatat (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # else -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, struct stat *__restrict __buf, @@ -287,7 +287,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, # endif # ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int fstatat64 (int __fd, const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); @@ -313,7 +313,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd, extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (lstat, (const char *__restrict __file, @@ -334,7 +334,7 @@ extern int __REDIRECT_NTH (lstat, # endif # endif # ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int lstat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); @@ -427,7 +427,7 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) #endif #ifdef __USE_ATFILE -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Set file access and modification times relative to directory file descriptor. */ extern int utimensat (int __fd, const char *__path, @@ -447,7 +447,7 @@ extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path, #endif #ifdef __USE_XOPEN2K8 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Set file access and modification times of the file associated with FD. */ extern int futimens (int __fd, const struct timespec __times[2]) __THROW; diff --git a/io/utime.h b/io/utime.h index c5eacedd6a..1c7587d9c1 100644 --- a/io/utime.h +++ b/io/utime.h @@ -35,7 +35,7 @@ __BEGIN_DECLS /* Structure describing file times. */ struct utimbuf { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS __time64_t actime; /* Access time. */ __time64_t modtime; /* Modification time. */ #else @@ -46,7 +46,7 @@ struct utimbuf /* Set the access and modification times of FILE to those given in *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int utime (const char *__file, const struct utimbuf *__file_times) __THROW __nonnull ((1)); -- cgit 1.4.1