public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] time_t.3type: reference _TIME_BITS
@ 2022-10-13 18:30 Sam James
  2022-10-13 18:30 ` [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS Sam James
  0 siblings, 1 reply; 7+ messages in thread
From: Sam James @ 2022-10-13 18:30 UTC (permalink / raw)
  To: Alejandro Colomar, Michael Kerrisk; +Cc: linux-man, Sam James

Just like we do with _FILE_OFFSET_BITS in off_t.3type.

Reference: https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration
Reference: https://sourceware.org/pipermail/libc-alpha/2022-January/134985.html
Signed-off-by: Sam James <sam@gentoo.org>
---
 man3type/time_t.3type | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/man3type/time_t.3type b/man3type/time_t.3type
index d40dd0c0d..9b8f07356 100644
--- a/man3type/time_t.3type
+++ b/man3type/time_t.3type
@@ -70,6 +70,12 @@ POSIX.1-2001 and later.
 POSIX.1-2001 and later.
 .PD
 .SH NOTES
+On some architectures,
+the width of
+.I time_t
+can be controlled with the feature test macro
+.BR _TIME_BITS .
+.PP
 .TP
 .I time_t
 The following headers also provide
-- 
2.38.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS
  2022-10-13 18:30 [PATCH v2 1/2] time_t.3type: reference _TIME_BITS Sam James
@ 2022-10-13 18:30 ` Sam James
  2022-10-13 18:47   ` Alejandro Colomar
  0 siblings, 1 reply; 7+ messages in thread
From: Sam James @ 2022-10-13 18:30 UTC (permalink / raw)
  To: Alejandro Colomar, Michael Kerrisk; +Cc: linux-man, Sam James

Reference: https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration
Reference: https://sourceware.org/pipermail/libc-alpha/2022-January/134985.html
Signed-off-by: Sam James <sam@gentoo.org>
---
 man7/feature_test_macros.7 | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7
index cdd962f7f..d33041001 100644
--- a/man7/feature_test_macros.7
+++ b/man7/feature_test_macros.7
@@ -412,6 +412,15 @@ large files with only a recompilation being required.)
 64-bit systems naturally permit file sizes greater than 2 Gigabytes,
 and on those systems this macro has no effect.
 .TP
+.B _TIME_BITS
+Defining this macro with the value 64
+changes the width of
+.BR time_t (3type)
+to 64-bit which allows handling of timestamps beyond
+2038. It is closely related to
+.B _FILE_OFFSET_BITS
+and depending on implementation, may require it set.
+.TP
 .BR _BSD_SOURCE " (deprecated since glibc 2.20)"
 Defining this macro with any value causes header files to expose
 BSD-derived definitions.
@@ -854,6 +863,10 @@ main(int argc, char *argv[])
     printf("_FILE_OFFSET_BITS defined: %d\en", _FILE_OFFSET_BITS);
 #endif
 
+#ifdef _TIME_BITS
+    printf("_TIME_BITS defined: %d\en", _TIME_BITS);
+#endif
+
 #ifdef _BSD_SOURCE
     printf("_BSD_SOURCE defined\en");
 #endif
-- 
2.38.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS
  2022-10-13 18:30 ` [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS Sam James
@ 2022-10-13 18:47   ` Alejandro Colomar
  2022-10-13 18:52     ` Sam James
  0 siblings, 1 reply; 7+ messages in thread
From: Alejandro Colomar @ 2022-10-13 18:47 UTC (permalink / raw)
  To: Sam James; +Cc: linux-man


[-- Attachment #1.1: Type: text/plain, Size: 2531 bytes --]

Hi Sam,

On 10/13/22 20:30, Sam James wrote:
> Reference: https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration
> Reference: https://sourceware.org/pipermail/libc-alpha/2022-January/134985.html
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
>   man7/feature_test_macros.7 | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7
> index cdd962f7f..d33041001 100644
> --- a/man7/feature_test_macros.7
> +++ b/man7/feature_test_macros.7
> @@ -412,6 +412,15 @@ large files with only a recompilation being required.)
>   64-bit systems naturally permit file sizes greater than 2 Gigabytes,
>   and on those systems this macro has no effect.
>   .TP
> +.B _TIME_BITS
> +Defining this macro with the value 64
> +changes the width of
> +.BR time_t (3type)
> +to 64-bit which allows handling of timestamps beyond
> +2038. It is closely related to

Please use semantic newlines.  See man-pages(7):

    Use semantic newlines
        In the source of a manual page, new sentences  should  be
        started on new lines, long sentences should be split into
        lines  at  clause breaks (commas, semicolons, colons, and
        so on), and long clauses should be split at phrase bound‐
        aries.  This convention,  sometimes  known  as  "semantic
        newlines",  makes it easier to see the effect of patches,
        which often operate at the level of individual sentences,
        clauses, or phrases.

That is: 's/2038. /2038.\n/'

> +.B _FILE_OFFSET_BITS
> +and depending on implementation, may require it set.

Am I understanding this right?  _FILE_OFFSET_BITS is required to be set 
for _TIME_BITS to be also set (in some archs)?  Could you please link 
directly to a source for that in the commit log?  They are somewhat 
related, but I'm quite surprised that something to do with file sizes 
interferes at all with something to do with time.

Thanks,

Alex

> +.TP
>   .BR _BSD_SOURCE " (deprecated since glibc 2.20)"
>   Defining this macro with any value causes header files to expose
>   BSD-derived definitions.
> @@ -854,6 +863,10 @@ main(int argc, char *argv[])
>       printf("_FILE_OFFSET_BITS defined: %d\en", _FILE_OFFSET_BITS);
>   #endif
>   
> +#ifdef _TIME_BITS
> +    printf("_TIME_BITS defined: %d\en", _TIME_BITS);
> +#endif
> +
>   #ifdef _BSD_SOURCE
>       printf("_BSD_SOURCE defined\en");
>   #endif

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS
  2022-10-13 18:47   ` Alejandro Colomar
@ 2022-10-13 18:52     ` Sam James
  2022-10-13 19:17       ` Alejandro Colomar
  2022-10-13 19:19       ` Alejandro Colomar
  0 siblings, 2 replies; 7+ messages in thread
From: Sam James @ 2022-10-13 18:52 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 2365 bytes --]



> On 13 Oct 2022, at 19:47, Alejandro Colomar <alx.manpages@gmail.com> wrote:
> 
> Hi Sam,
> 
> On 10/13/22 20:30, Sam James wrote:
>> Reference: https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration
>> Reference: https://sourceware.org/pipermail/libc-alpha/2022-January/134985.html
>> Signed-off-by: Sam James <sam@gentoo.org>
>> ---
>>  man7/feature_test_macros.7 | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>> diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7
>> index cdd962f7f..d33041001 100644
>> --- a/man7/feature_test_macros.7
>> +++ b/man7/feature_test_macros.7
>> @@ -412,6 +412,15 @@ large files with only a recompilation being required.)
>>  64-bit systems naturally permit file sizes greater than 2 Gigabytes,
>>  and on those systems this macro has no effect.
>>  .TP
>> +.B _TIME_BITS
>> +Defining this macro with the value 64
>> +changes the width of
>> +.BR time_t (3type)
>> +to 64-bit which allows handling of timestamps beyond
>> +2038. It is closely related to
> 
> Please use semantic newlines.  See man-pages(7):
> 
>   Use semantic newlines
>       In the source of a manual page, new sentences  should  be
>       started on new lines, long sentences should be split into
>       lines  at  clause breaks (commas, semicolons, colons, and
>       so on), and long clauses should be split at phrase bound‐
>       aries.  This convention,  sometimes  known  as  "semantic
>       newlines",  makes it easier to see the effect of patches,
>       which often operate at the level of individual sentences,
>       clauses, or phrases.
> 

Mea culpa -- let me read that over again :)

> That is: 's/2038. /2038.\n/'
> 
>> +.B _FILE_OFFSET_BITS
>> +and depending on implementation, may require it set.
> 
> Am I understanding this right?  _FILE_OFFSET_BITS is required to be set for _TIME_BITS to be also set (in some archs)?  Could you please link directly to a source for that in the commit log?  They are somewhat related, but I'm quite surprised that something to do with file sizes interferes at all with something to do with time.
> 

Yes, it's shocking, but true!

I'll add a reference -- but it's in /usr/include/features-time64.h:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/features-time64.h

Best,
sam

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS
  2022-10-13 18:52     ` Sam James
@ 2022-10-13 19:17       ` Alejandro Colomar
  2022-10-13 20:57         ` Sam James
  2022-10-13 19:19       ` Alejandro Colomar
  1 sibling, 1 reply; 7+ messages in thread
From: Alejandro Colomar @ 2022-10-13 19:17 UTC (permalink / raw)
  To: Sam James; +Cc: linux-man


[-- Attachment #1.1: Type: text/plain, Size: 712 bytes --]

On 10/13/22 20:52, Sam James wrote:
>> Am I understanding this right?  _FILE_OFFSET_BITS is required to be set for _TIME_BITS to be also set (in some archs)?  Could you please link directly to a source for that in the commit log?  They are somewhat related, but I'm quite surprised that something to do with file sizes interferes at all with something to do with time.
>>
> 
> Yes, it's shocking, but true!
> 
> I'll add a reference -- but it's in /usr/include/features-time64.h:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/features-time64.h

O.O  Yes, it seems to also be in the glibc documentation.  Weird.

Cheers,

Alex

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS
  2022-10-13 18:52     ` Sam James
  2022-10-13 19:17       ` Alejandro Colomar
@ 2022-10-13 19:19       ` Alejandro Colomar
  1 sibling, 0 replies; 7+ messages in thread
From: Alejandro Colomar @ 2022-10-13 19:19 UTC (permalink / raw)
  To: Sam James; +Cc: linux-man


[-- Attachment #1.1: Type: text/plain, Size: 935 bytes --]

On 10/13/22 20:52, Sam James wrote:
>>
>> Please use semantic newlines.  See man-pages(7):
>>
>>    Use semantic newlines
>>        In the source of a manual page, new sentences  should  be
>>        started on new lines, long sentences should be split into
>>        lines  at  clause breaks (commas, semicolons, colons, and
>>        so on), and long clauses should be split at phrase bound‐
>>        aries.  This convention,  sometimes  known  as  "semantic
>>        newlines",  makes it easier to see the effect of patches,
>>        which often operate at the level of individual sentences,
>>        clauses, or phrases.
>>
> 
> Mea culpa -- let me read that over again :)

If you're curious, here you'll find a bit more about it:
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit?id=6ff6f43d68164f99a8c3fb66f4525d145571310c>

Cheers,

Alex

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS
  2022-10-13 19:17       ` Alejandro Colomar
@ 2022-10-13 20:57         ` Sam James
  0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2022-10-13 20:57 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

[-- Attachment #1: Type: text/plain, Size: 850 bytes --]



> On 13 Oct 2022, at 20:17, Alejandro Colomar <alx.manpages@gmail.com> wrote:
> 
> On 10/13/22 20:52, Sam James wrote:
>>> Am I understanding this right?  _FILE_OFFSET_BITS is required to be set for _TIME_BITS to be also set (in some archs)?  Could you please link directly to a source for that in the commit log?  They are somewhat related, but I'm quite surprised that something to do with file sizes interferes at all with something to do with time.
>>> 
>> Yes, it's shocking, but true!
>> I'll add a reference -- but it's in /usr/include/features-time64.h:
>> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/features-time64.h
> 
> O.O  Yes, it seems to also be in the glibc documentation.  Weird.
> 

You can imagine my surprise when I only hit this when something failed to compile
with the #error...

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-13 20:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-13 18:30 [PATCH v2 1/2] time_t.3type: reference _TIME_BITS Sam James
2022-10-13 18:30 ` [PATCH v2 2/2] feature_test_macros.7: document _TIME_BITS Sam James
2022-10-13 18:47   ` Alejandro Colomar
2022-10-13 18:52     ` Sam James
2022-10-13 19:17       ` Alejandro Colomar
2022-10-13 20:57         ` Sam James
2022-10-13 19:19       ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox