Re: git: ee2e36686e84 - main - linprocfs: Really fix time_t type issue

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Sun, 12 May 2024 11:37:11 UTC
On Sun, May 12, 2024 at 04:57:19AM +0000, Warner Losh wrote:
> The branch main has been updated by imp:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=ee2e36686e846d412deac23344185f4b8a8c0285
> 
> commit ee2e36686e846d412deac23344185f4b8a8c0285
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2024-05-12 04:53:15 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-05-12 04:53:15 +0000
> 
>     linprocfs: Really fix time_t type issue
>     
>     The cast to (long) is wrong on all the other 32-bit platforms. (long
>     long) is the correct type on all platforms. Also, use a z modifier for
>     size_t which also fails on 32-bit platforms.
>     
>     Fixes: 02f481a30b82
>     Sponsored by: Netflix
> ---
>  sys/compat/linprocfs/linprocfs.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
> index aa5af0b3c1c1..dd04adc054db 100644
> --- a/sys/compat/linprocfs/linprocfs.c
> +++ b/sys/compat/linprocfs/linprocfs.c
> @@ -2133,7 +2133,7 @@ again:
>  	for (id = 0; id < msgmni; id++)
>  		if (msqids[id].u.msg_qbytes != 0)
>  			sbuf_printf(sb,
> -			    "%10d %10lu  %4o  %10lu %10lu %5u %5u %5u %5u %5u %5u %10ld %10ld %10ld\n",
> +			    "%10d %10lu  %4o  %10lu %10lu %5u %5u %5u %5u %5u %5u %10lld %10lld %10lld\n",
>  			    (int) msqids[id].u.msg_perm.key,
>  			    IXSEQ_TO_IPCID(id, msqids[id].u.msg_perm),
>  			    msqids[id].u.msg_perm.mode,
The canonical and bde' approved way to print integrals which size if MD
is to use %jd format modifier and cast to intmax_t.