From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: DJ Delorie <dj@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v4] Always define __USE_TIME_BITS64 when 64 bit time_t is used
Date: Mon, 18 Mar 2024 08:42:10 -0300 [thread overview]
Message-ID: <b374aaa6-e00c-46da-aafe-a1459576a537@linaro.org> (raw)
In-Reply-To: <xnedcb89ke.fsf@greed.delorie.com>
On 15/03/24 18:33, DJ Delorie wrote:
>
> 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...
Right, I will move it to creature.texi. It makes more sense, since it
should be a user-visible macro (albeit in the implementation-defined
namespace).
>
>> 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 :-)
>
next prev parent reply other threads:[~2024-03-18 11:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 16:57 [PATCH v4] Always define __USE_TIME_BITS64 when 64 bit time_t is used Adhemerval Zanella
2024-03-15 21:33 ` DJ Delorie
2024-03-18 11:42 ` Adhemerval Zanella Netto [this message]
2024-03-16 9:04 ` Mark Harris
2024-03-18 11:21 ` Adhemerval Zanella Netto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b374aaa6-e00c-46da-aafe-a1459576a537@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=dj@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).