public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH 3/4] clock_getres.2, clock_nanosleep.2, io_getevents.2, nanosleep.2, poll.2, sched_rr_get_interval.2, select.2, sigwaitinfo.2, timer_settime.2, timerfd_create.2, utimensat.2, mq_receive.3, mq_send.3, pthread_tryjoin_np.3, system_data_types.7: correct struct timespec::tv_nsec type for x32
Date: Mon, 29 Nov 2021 13:31:48 +0100	[thread overview]
Message-ID: <c2b59b57-ed75-3530-3ac7-13c187700410@gmail.com> (raw)
In-Reply-To: <de0b63287590038675ef723e052ec1d765f7c59b.1638123425.git.nabijaczleweli@nabijaczleweli.xyz>

Hi наб,

On 11/28/21 19:17, наб wrote:
> There are three files that govern userspace struct timespec on glibc:
> 1. bits/wordsize.h, defining:
>     (a) __WORDSIZE to 32 on ILP32 and 64 on LP64
>     (b) on x32: __SYSCALL_WORDSIZE to 64
> 2. bits/timesize.h, defining
>     (a) __TIMESIZE to __WORDSIZE, except on x32 where it's 64
> 3. bits/types/struct_timespec.h, declaring struct timespec as:
>       struct timespec
>       {
>        __time_t tv_sec;      /* Seconds.  */
>       #if __WORDSIZE == 64 \
>        || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
>        || __TIMESIZE == 32
>        __syscall_slong_t tv_nsec;    /* Nanoseconds.  */
>       #else
>       # if __BYTE_ORDER == __BIG_ENDIAN
>        int: 32;           /* Padding.  */
>        long int tv_nsec;  /* Nanoseconds.  */
>       # else
>        long int tv_nsec;  /* Nanoseconds.  */
>        int: 32;           /* Padding.  */
>       # endif
>       #endif
>       };
>     this has two side-effects: struct timespec
>     (a) is always sizeof==time_t+8, and
>     (b) has tv_nsec as __syscall_slong_t
>         *and* !is_same<__syscall_slong_t, long>
>         if using ILP64 syscalls on an LP32 system, i.e. on x32.

I guess you meant LP64, not ILP64?
AFAIK, glibc doesn't support ILP64.

Other than that, the commit looks good to me.

But this would be a simpler commit if we only had one definition.  Do 
you agree in changing the whole patch set in that (IMO simpler) way?


Thanks,

Alex

> 
> This means, that the simplified
>    struct timespec {
>        time_t  tv_sec;  /* Seconds */
>        long    tv_nsec; /* Nanoseconds [0 .. 999999999] */
>    };
> declaration is *invalid* for x32,
> where struct timespec::tv_nsec is an int64_t (long long).
> 
> Transformation snippet:
>    sed -i -e '/Nanoseconds \[0/i#if !(__x86_64__ && __ILP32__ /* == x32 */)' -e '/Nanoseconds \[0/a#else\
>        long long tv_nsec;\
>    #endif' man2/clock_getres.2 man2/clock_nanosleep.2 man2/io_getevents.2 man2/nanosleep.2 man2/poll.2 man2/sched_rr_get_interval.2 man2/select.2 man2/sigwaitinfo.2 man2/timer_settime.2 man2/timerfd_create.2 man2/utimensat.2 man3/mq_receive.3 man3/mq_send.3 man3/pthread_tryjoin_np.3 man7/system_data_types.7
> 
> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
> ---
>   man2/clock_getres.2          | 4 ++++
>   man2/clock_nanosleep.2       | 4 ++++
>   man2/io_getevents.2          | 4 ++++
>   man2/nanosleep.2             | 4 ++++
>   man2/poll.2                  | 4 ++++
>   man2/sched_rr_get_interval.2 | 4 ++++
>   man2/select.2                | 4 ++++
>   man2/sigwaitinfo.2           | 4 ++++
>   man2/timer_settime.2         | 4 ++++
>   man2/timerfd_create.2        | 4 ++++
>   man2/utimensat.2             | 4 ++++
>   man3/mq_receive.3            | 4 ++++
>   man3/mq_send.3               | 4 ++++
>   man3/pthread_tryjoin_np.3    | 4 ++++
>   man7/system_data_types.7     | 4 ++++
>   15 files changed, 60 insertions(+)
> 
> diff --git a/man2/clock_getres.2 b/man2/clock_getres.2
> index f94b69d3c..0d9326b84 100644
> --- a/man2/clock_getres.2
> +++ b/man2/clock_getres.2
> @@ -94,7 +94,11 @@ structures, as specified in
>   .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
>   };
>   .EE
>   .in
> diff --git a/man2/clock_nanosleep.2 b/man2/clock_nanosleep.2
> index e6386e6a5..06ad6acf3 100644
> --- a/man2/clock_nanosleep.2
> +++ b/man2/clock_nanosleep.2
> @@ -65,7 +65,11 @@ structures, defined as follows:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man2/io_getevents.2 b/man2/io_getevents.2
> index 08738e413..020cb5882 100644
> --- a/man2/io_getevents.2
> +++ b/man2/io_getevents.2
> @@ -47,7 +47,11 @@ and is specified as a relative timeout in a structure of the following form:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man2/nanosleep.2 b/man2/nanosleep.2
> index 993007e92..81f5d93a5 100644
> --- a/man2/nanosleep.2
> +++ b/man2/nanosleep.2
> @@ -85,7 +85,11 @@ It is defined as follows:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man2/poll.2 b/man2/poll.2
> index a278efbcc..1bdd06ded 100644
> --- a/man2/poll.2
> +++ b/man2/poll.2
> @@ -330,7 +330,11 @@ This argument is a pointer to a structure of the following form:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man2/sched_rr_get_interval.2 b/man2/sched_rr_get_interval.2
> index 1f249572b..ee9067c20 100644
> --- a/man2/sched_rr_get_interval.2
> +++ b/man2/sched_rr_get_interval.2
> @@ -55,7 +55,11 @@ structure has the following form:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man2/select.2 b/man2/select.2
> index fd9a994eb..dad9e8937 100644
> --- a/man2/select.2
> +++ b/man2/select.2
> @@ -359,7 +359,11 @@ has the following type:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man2/sigwaitinfo.2 b/man2/sigwaitinfo.2
> index 226625e4e..e2dcb5eef 100644
> --- a/man2/sigwaitinfo.2
> +++ b/man2/sigwaitinfo.2
> @@ -94,7 +94,11 @@ This argument is of the following type:
>   .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
>   }
>   .EE
>   .in
> diff --git a/man2/timer_settime.2 b/man2/timer_settime.2
> index 1c8d7fa17..a76fb9b10 100644
> --- a/man2/timer_settime.2
> +++ b/man2/timer_settime.2
> @@ -67,7 +67,11 @@ structure is defined as follows:
>   .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
>   };
>   
>   struct itimerspec {
> diff --git a/man2/timerfd_create.2 b/man2/timerfd_create.2
> index 832ec4b68..4bf8a3a4b 100644
> --- a/man2/timerfd_create.2
> +++ b/man2/timerfd_create.2
> @@ -159,7 +159,11 @@ each of which is in turn a structure of type
>   .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
>   };
>   
>   struct itimerspec {
> diff --git a/man2/utimensat.2 b/man2/utimensat.2
> index 19fa8c677..c806c51a5 100644
> --- a/man2/utimensat.2
> +++ b/man2/utimensat.2
> @@ -94,7 +94,11 @@ This information is conveyed in a structure of the following form:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man3/mq_receive.3 b/man3/mq_receive.3
> index 4dac43643..deda2d452 100644
> --- a/man3/mq_receive.3
> +++ b/man3/mq_receive.3
> @@ -98,7 +98,11 @@ specified in the following structure:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man3/mq_send.3 b/man3/mq_send.3
> index 6b3fbe98a..c0e67df34 100644
> --- a/man3/mq_send.3
> +++ b/man3/mq_send.3
> @@ -107,7 +107,11 @@ specified in the following structure:
>   .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
>   };
>   .EE
>   .in
> diff --git a/man3/pthread_tryjoin_np.3 b/man3/pthread_tryjoin_np.3
> index 10b498c80..d68c2bbba 100644
> --- a/man3/pthread_tryjoin_np.3
> +++ b/man3/pthread_tryjoin_np.3
> @@ -80,7 +80,11 @@ specifying an absolute time measured since the Epoch (see
>   .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
>   };
>   .EE
>   .in
> 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
>   };
>   .EE
>   .PP
> 

-- 
Alejandro Colomar
Linux man-pages comaintainer; http://www.kernel.org/doc/man-pages/

  parent reply	other threads:[~2021-11-29 13:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 18:17 [PATCH 1/4] clock_getres.2, clock_nanosleep.2, io_getevents.2, nanosleep.2, poll.2, sched_rr_get_interval.2, select.2, sigwaitinfo.2, timer_settime.2, timerfd_create.2, utimensat.2, mq_receive.3, mq_send.3, pthread_tryjoin_np.3, sem_wait.3, system_data_types.7: standardise on struct timespec fields comments to ucase w/tv_nsec range наб
2021-11-28 18:17 ` [PATCH 2/4] poll.2, sigwaitinfo.2: fix struct timespec::tv_sec to be time_t, not long наб
2021-11-29 12:27   ` Alejandro Colomar (man-pages)
2021-11-28 18:17 ` [PATCH 3/4] clock_getres.2, clock_nanosleep.2, io_getevents.2, nanosleep.2, poll.2, sched_rr_get_interval.2, select.2, sigwaitinfo.2, timer_settime.2, timerfd_create.2, utimensat.2, mq_receive.3, mq_send.3, pthread_tryjoin_np.3, system_data_types.7: correct struct timespec::tv_nsec type for x32 наб
2021-11-29  9:45   ` Jakub Wilk
2021-11-29 12:31   ` Alejandro Colomar (man-pages) [this message]
2021-12-03 23:46     ` наб
2021-12-06 19:18       ` [PATCH 3/4] Many pages: " Alejandro Colomar (man-pages)
2021-12-06 20:11         ` [PATCH v2 0/4] timespec(3) migration наб
2021-12-06 20:12           ` [PATCH v2 1/4] clock_getres.2, clock_nanosleep.2, io_getevents.2, nanosleep.2, poll.2, sched_rr_get_interval.2, select.2, sigwaitinfo.2, timerfd_create.2, timer_settime.2, utimensat.2, mq_receive.3, mq_send.3, pthread_tryjoin_np.3, sem_wait.3: replace in-line struct timespec declarations with "timespec(3) structure" references наб
2021-12-06 21:14             ` Alejandro Colomar (man-pages)
2021-12-06 20:12           ` [PATCH v2 2/4] system_data_types.7: standardise on struct timespec fields comments to ucase w/tv_nsec range наб
2021-12-06 21:18             ` Alejandro Colomar (man-pages)
2021-12-06 20:12           ` [PATCH v2 3/4] system_data_types.7: correct struct timespec::tv_nsec type for x32 наб
2021-12-06 21:30             ` Alejandro Colomar (man-pages)
2021-12-06 22:03               ` [PATCH v3 3/3] system_data_types.7: note struct timespec::tv_nsec type for x32 and portability наб
2021-12-06 22:56                 ` Alejandro Colomar (man-pages)
2021-12-06 23:31                   ` наб
2021-12-07  0:38                     ` Alejandro Colomar (man-pages)
2021-12-07  1:08                       ` наб
2021-12-07  1:34                         ` Alejandro Colomar (man-pages)
     [not found]                     ` <a55c07d0-960f-4dfe-90bf-4fee33976198@www.fastmail.com>
     [not found]                       ` <7c29781b-1030-44f9-b078-f5b09a14e321@gmail.com>
2021-12-07  1:41                         ` наб
2021-12-07 18:43                           ` Joseph Myers
2021-12-07 18:52                             ` Florian Weimer
2022-01-03 15:44                           ` наб
2022-01-03 16:54                             ` Alejandro Colomar (man-pages)
2021-12-07 11:02               ` [PATCH v2 3/4] system_data_types.7: correct struct timespec::tv_nsec type for x32 Stefan Puiu
2021-12-07 11:05                 ` Alejandro Colomar (man-pages)
2021-12-06 20:12           ` [PATCH v2 4/4] system_data_types.7: note that struct timespec::tv_nsec being long long on x32 is an extension наб
2021-11-28 18:17 ` [PATCH " наб
2021-11-29 12:26 ` [PATCH 1/4] clock_getres.2, clock_nanosleep.2, io_getevents.2, nanosleep.2, poll.2, sched_rr_get_interval.2, select.2, sigwaitinfo.2, timer_settime.2, timerfd_create.2, utimensat.2, mq_receive.3, mq_send.3, pthread_tryjoin_np.3, sem_wait.3, system_data_types.7: standardise on struct timespec fields comments to ucase w/tv_nsec range Alejandro Colomar (man-pages)

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2b59b57-ed75-3530-3ac7-13c187700410@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    /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