[PATCH v4] Always define __USE_TIME_BITS64 when 64 bit time_t is used
DJ Delorie
dj@redhat.com
Fri Mar 15 21:33:05 GMT 2024
Fun stuff first...
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> diff --git a/manual/maint.texi b/manual/maint.texi
>
> +When @code{__TIMESIZE == 64} is set, @theglibc{} will also define the
> +@code{__USE_TIME_BITS64}. It is used by the Linux kernel ABI to set the
> +expected @code{time_t} size used on some syscalls.
This part seems OK.
> +Also, to define whether
> +the declarations are expanded to 64-bit @code{time_t} symbols (since not
> +all ABIs do require such expansion), @theglibc{} will also define
> +@code{__USE_TIME64_REDIRECTS}.
This part doesn't match the code, because it's in the __TIMESIZE==64
section, and the code only sets it when __TIMESIZE==32:
#if defined __USE_TIME_BITS64 && __TIMESIZE == 32
# define __USE_TIME64_REDIRECTS 1
#endif
Perhaps you were thinking of _TIME_BITS==64, which is defined elsewhere?
_TIME_BITS is defined in creature.texi as a user-defined feature test macro...
> diff --git a/sysdeps/unix/sysv/linux/features-time64.h b/sysdeps/unix/sysv/linux/features-time64.h
> # if _TIME_BITS == 64
> # if ! defined (_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64
> # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
> -# elif __TIMESIZE == 32
> -# define __USE_TIME_BITS64 1
> # endif
> +# define __USE_TIME_BITS64 1
If the user asks for 64-bit time, we honor it, whether __TIMESIZE is 32
or 64. Ok.
If the user asks for 32-bit time, we allow it, but need do nothing. Ok.
> # elif _TIME_BITS == 32
> # if __TIMESIZE > 32
> # error "_TIME_BITS=32 is not compatible with __TIMESIZE > 32"
> @@ -34,4 +33,10 @@
> # else
> # error Invalid _TIME_BITS value (can only be 32 or 64-bit)
> # endif
This is for when _TIME_BITS is not set:
> +#elif __TIMESIZE == 64
> +# define __USE_TIME_BITS64 1
> +#endif
So if the user does not specify _TIME_BITS, we default to 64-bit kabi
for 64-bit time_t. OK.
> +#if defined __USE_TIME_BITS64 && __TIMESIZE == 32
> +# define __USE_TIME64_REDIRECTS 1
> #endif
If we want 64-bit time_t (for any reason) but the default time_t is 32
bits, we need the redirected functions et al. Ok.
> diff --git a/sysdeps/generic/features-time64.h b/sysdeps/generic/features-time64.h
> /* The generic configuration only support _TIME_BITS=32. */
> +#define __USE_TIME_BITS64 0
> +/* The following macro defines whether the 64 time_t redirects will be
> + used for 64 bit aware symbols. */
> +#define __USE_TIME64_REDIRECTS 0
So the default for non-linux platforms is to not do any of the linux
magic. Ok.
And now for the mechanical part...
> diff --git a/io/bits/poll2.h b/io/bits/poll2.h
> . . .
> diff --git a/time/time.h b/time/time.h
They're all good :-)
More information about the Libc-alpha
mailing list