aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-01-18 10:18:01 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-02 15:28:36 -0300
commita4ed0471d71739928a0d0fa3258b3ff3b158e9b9 (patch)
treedb8118e3d4c787cdae80d343bb40bb7fc7ed2926 /time
parenta0698a5e92ceeed3409d28623b1d599da6bc887d (diff)
downloadglibc-a4ed0471d71739928a0d0fa3258b3ff3b158e9b9.zip
glibc-a4ed0471d71739928a0d0fa3258b3ff3b158e9b9.tar.gz
glibc-a4ed0471d71739928a0d0fa3258b3ff3b158e9b9.tar.bz2
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 'time')
-rw-r--r--time/bits/types/struct_timespec.h4
-rw-r--r--time/bits/types/struct_timeval.h2
-rw-r--r--time/bits/types/time_t.h2
-rw-r--r--time/sys/time.h10
-rw-r--r--time/time.h24
5 files changed, 21 insertions, 21 deletions
diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h
index 489e811..1141015 100644
--- a/time/bits/types/struct_timespec.h
+++ b/time/bits/types/struct_timespec.h
@@ -10,14 +10,14 @@
has nanoseconds instead of microseconds. */
struct timespec
{
-#ifdef __USE_TIME_BITS64
+#ifdef __USE_TIME64_REDIRECTS
__time64_t tv_sec; /* Seconds. */
#else
__time_t tv_sec; /* Seconds. */
#endif
#if __WORDSIZE == 64 \
|| (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
- || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64)
+ || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS)
__syscall_slong_t tv_nsec; /* Nanoseconds. */
#else
# if __BYTE_ORDER == __BIG_ENDIAN
diff --git a/time/bits/types/struct_timeval.h b/time/bits/types/struct_timeval.h
index 3466137..0c8e88c 100644
--- a/time/bits/types/struct_timeval.h
+++ b/time/bits/types/struct_timeval.h
@@ -7,7 +7,7 @@
microsecond but also has a range of years. */
struct timeval
{
-#ifdef __USE_TIME_BITS64
+#ifdef __USE_TIME64_REDIRECTS
__time64_t tv_sec; /* Seconds. */
__suseconds64_t tv_usec; /* Microseconds. */
#else
diff --git a/time/bits/types/time_t.h b/time/bits/types/time_t.h
index 84d67f6..00cde92 100644
--- a/time/bits/types/time_t.h
+++ b/time/bits/types/time_t.h
@@ -4,7 +4,7 @@
#include <bits/types.h>
/* Returned by `time'. */
-#ifdef __USE_TIME_BITS64
+#ifdef __USE_TIME64_REDIRECTS
typedef __time64_t time_t;
#else
typedef __time_t time_t;
diff --git a/time/sys/time.h b/time/sys/time.h
index c870819..8c3d0c3 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -63,7 +63,7 @@ struct timezone
use localtime etc. instead.
This function itself is semi-obsolete;
most callers should use time or clock_gettime instead. */
-#ifndef __USE_TIME_BITS64
+#ifndef __USE_TIME64_REDIRECTS
extern int gettimeofday (struct timeval *__restrict __tv,
void *__restrict __tz) __THROW __nonnull ((1));
#else
@@ -77,7 +77,7 @@ extern int __REDIRECT_NTH (gettimeofday, (struct timeval *__restrict __tv,
#endif
#ifdef __USE_MISC
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Set the current time of day and timezone information.
This call is restricted to the super-user.
Setting the timezone in this way is obsolete, but we don't yet
@@ -143,7 +143,7 @@ typedef enum __itimer_which __itimer_which_t;
typedef int __itimer_which_t;
#endif
-#ifndef __USE_TIME_BITS64
+#ifndef __USE_TIME64_REDIRECTS
/* Set *VALUE to the current setting of timer WHICH.
Return 0 on success, -1 on errors. */
extern int getitimer (__itimer_which_t __which,
@@ -184,7 +184,7 @@ extern int __REDIRECT_NTH (utimes, (const char *__file,
#endif
#ifdef __USE_MISC
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Same as `utimes', but does not follow symbolic links. */
extern int lutimes (const char *__file, const struct timeval __tvp[2])
__THROW __nonnull ((1));
@@ -207,7 +207,7 @@ extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval __tvp[2]),
#endif
#ifdef __USE_GNU
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Change the access time of FILE relative to FD to TVP[0] and the
modification time of FILE to TVP[1]. If TVP is a null pointer, use
the current time instead. Returns 0 on success, -1 on errors. */
diff --git a/time/time.h b/time/time.h
index b34cf22..bc04318 100644
--- a/time/time.h
+++ b/time/time.h
@@ -71,7 +71,7 @@ __BEGIN_DECLS
The result / CLOCKS_PER_SEC is program time in seconds. */
extern clock_t clock (void) __THROW;
-#ifndef __USE_TIME_BITS64
+#ifndef __USE_TIME64_REDIRECTS
/* Return the current time and put it in *TIMER if TIMER is not NULL. */
extern time_t time (time_t *__timer) __THROW;
@@ -127,7 +127,7 @@ extern char *strptime_l (const char *__restrict __s,
#endif
-#ifndef __USE_TIME_BITS64
+#ifndef __USE_TIME64_REDIRECTS
/* Return the `struct tm' representation of *TIMER
in Universal Coordinated Time (aka Greenwich Mean Time). */
extern struct tm *gmtime (const time_t *__timer) __THROW;
@@ -149,7 +149,7 @@ extern struct tm *__REDIRECT_NTH (localtime, (const time_t *__timer),
#if defined __USE_POSIX || __GLIBC_USE (ISOC23)
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Return the `struct tm' representation of *TIMER in UTC,
using *TP to store the result. */
extern struct tm *gmtime_r (const time_t *__restrict __timer,
@@ -180,7 +180,7 @@ extern struct tm*__REDIRECT_NTH (localtime_r, (const time_t *__restrict __t,
extern char *asctime (const struct tm *__tp) __THROW;
/* Equivalent to `asctime (localtime (timer))'. */
-#ifndef __USE_TIME_BITS64
+#ifndef __USE_TIME64_REDIRECTS
extern char *ctime (const time_t *__timer) __THROW;
#else
# ifdef __REDIRECT_NTH
@@ -199,7 +199,7 @@ extern char *asctime_r (const struct tm *__restrict __tp,
char *__restrict __buf) __THROW;
/* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */
-#ifndef __USE_TIME_BITS64
+#ifndef __USE_TIME64_REDIRECTS
extern char *ctime_r (const time_t *__restrict __timer,
char *__restrict __buf) __THROW;
#else
@@ -242,7 +242,7 @@ extern long int timezone;
#if defined __USE_MISC || __GLIBC_USE (ISOC23)
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Like `mktime', but for TP represents Universal Time, not local time. */
extern time_t timegm (struct tm *__tp) __THROW;
# else
@@ -259,7 +259,7 @@ extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64);
/* Miscellaneous functions many Unices inherited from the public domain
localtime package. These are included only for compatibility. */
-#ifndef __USE_TIME_BITS64
+#ifndef __USE_TIME64_REDIRECTS
/* Another name for `mktime'. */
extern time_t timelocal (struct tm *__tp) __THROW;
#else
@@ -274,7 +274,7 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__));
#ifdef __USE_POSIX199309
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Pause execution for a number of nanoseconds.
This function is a cancellation point and therefore not marked with
@@ -320,7 +320,7 @@ extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct
This function is a cancellation point and therefore not marked with
__THROW. */
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
extern int clock_nanosleep (clockid_t __clock_id, int __flags,
const struct timespec *__req,
struct timespec *__rem);
@@ -349,7 +349,7 @@ extern int timer_create (clockid_t __clock_id,
extern int timer_delete (timer_t __timerid) __THROW;
/* Set timer TIMERID to VALUE, returning old value in OVALUE. */
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
extern int timer_settime (timer_t __timerid, int __flags,
const struct itimerspec *__restrict __value,
struct itimerspec *__restrict __ovalue) __THROW;
@@ -379,7 +379,7 @@ extern int timer_getoverrun (timer_t __timerid) __THROW;
#ifdef __USE_ISOC11
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Set TS to calendar time based in time base BASE. */
extern int timespec_get (struct timespec *__ts, int __base)
__THROW __nonnull ((1));
@@ -395,7 +395,7 @@ extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int __base),
#if __GLIBC_USE (ISOC23)
-# ifndef __USE_TIME_BITS64
+# ifndef __USE_TIME64_REDIRECTS
/* Set TS to resolution of time base BASE. */
extern int timespec_getres (struct timespec *__ts, int __base)
__THROW;