Re: [PATCH v2 3/4] system_data_types.7: correct struct timespec::tv_nsec type for x32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Just a little nitpick below...

On Tue, Dec 7, 2021 at 7:56 AM Alejandro Colomar (man-pages)
<alx.manpages@xxxxxxxxx> wrote:
>
> Hi наб,
>
> On 12/6/21 21:12, наб wrote:
> > diff --git a/man7/system_data_types.7 b/man7/system_data_types.7
> > index 1e6a3f74c..80679b180 100644
> > --- a/man7/system_data_types.7
> > +++ b/man7/system_data_types.7
> > @@ -1544,7 +1544,11 @@ or
> >   .EX
> >   struct timespec {
> >       time_t  tv_sec;  /* Seconds */
> > +#if !(__x86_64__ && __ILP32__ /* == x32 */)
> >       long    tv_nsec; /* Nanoseconds [0 .. 999999999] */
> > +#else
> > +    long long tv_nsec;
> > +#endif
>
> I prefer showing there the (simple) POSIX definition, and then in Notes
> add a message that glibc uses a different type on most systems.
> Otherwise, we're loosing the information that non-glibc systems use long.
>
> How about something like the following?:
>
> Notes: glibc uses long long instead of long for tv_nsec in some
> architectures:
>
>         #if !(__x86_64__ && __ILP32__ /* == x32 */)
>                 long      tv_nsec;
>         #else
>                 long long tv_nsec;
>         #endif

The #if condition is actually "we're not on x32", so maybe the comment
could say /* != x32 */? Otherwise it looks like the comment
contradicts the code; I know the comment is inside the paranthesis,
and the negation ('!') is outside, but the negation might be easy to
overlook.

Or maybe leave the x32 field size for a note? (E.g. something like
"This is true on almost all arches, but see NOTES", and then under
NOTES specify that "actually, on x32 tv_nsec is long long"). The #if
in the definition doesn't *exactly* match the code anyway.

Thanks,
Stefan.

>
>
> BTW, I don't understand why long long, if long can perfectly represent 0
> .. 999999999.  If you know the rationale for such extension, it would be
> a great addition to Notes too.
>
> Thanks!
>
> Alex
>
> >   };
> >   .EE
> >   .PP
> >
>
>
> --
> Alejandro Colomar
> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> http://www.alejandro-colomar.es/




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux