Re: git: 02f481a30b82 - main - linprocfs: Fix i386 time type

From: Warner Losh <imp_at_bsdimp.com>
Date: Sun, 12 May 2024 01:21:21 UTC
On Sat, May 11, 2024, 6:39 PM Warner Losh <imp@freebsd.org> wrote:

> The branch main has been updated by imp:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=02f481a30b8269c7cad24ec2920ca09751708a1e
>
> commit 02f481a30b8269c7cad24ec2920ca09751708a1e
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2024-05-11 22:36:23 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-05-12 00:38:17 +0000
>
>     linprocfs: Fix i386 time type
>
>     Cast the time type to (long). This is correct on all architectures. On
>     i386, this promotes the int time_t to a long (which is also 32-bit). On
>     64-bit architectures, this promotes the 64-bit signed time_t to a
> 64-bit
>     signed int type.
>

While this compiles everywhere, it will trucate on armv7 and powerpc. I'll
fix it after the play I'm about to see when I realized this. Sorry for the
churn.

Warner

    Sponsored by:           Netflix
> ---
>  sys/compat/linprocfs/linprocfs.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/sys/compat/linprocfs/linprocfs.c
> b/sys/compat/linprocfs/linprocfs.c
> index a877d4065c18..aa5af0b3c1c1 100644
> --- a/sys/compat/linprocfs/linprocfs.c
> +++ b/sys/compat/linprocfs/linprocfs.c
> @@ -2145,9 +2145,9 @@ again:
>                             msqids[id].u.msg_perm.gid,
>                             msqids[id].u.msg_perm.cuid,
>                             msqids[id].u.msg_perm.cgid,
> -                           msqids[id].u.msg_stime,
> -                           msqids[id].u.msg_rtime,
> -                           msqids[id].u.msg_ctime);
> +                           (long)msqids[id].u.msg_stime,
> +                           (long)msqids[id].u.msg_rtime,
> +                           (long)msqids[id].u.msg_ctime);
>
>         free(msqids, M_TEMP);
>         return (0);
> @@ -2199,8 +2199,8 @@ again:
>                             semids[id].u.sem_perm.gid,
>                             semids[id].u.sem_perm.cuid,
>                             semids[id].u.sem_perm.cgid,
> -                           semids[id].u.sem_otime,
> -                           semids[id].u.sem_ctime);
> +                           (long)semids[id].u.sem_otime,
> +                           (long)semids[id].u.sem_ctime);
>
>         free(semids, M_TEMP);
>         return (0);
> @@ -2256,9 +2256,9 @@ again:
>                             shmids[id].u.shm_perm.gid,
>                             shmids[id].u.shm_perm.cuid,
>                             shmids[id].u.shm_perm.cgid,
> -                           shmids[id].u.shm_atime,
> -                           shmids[id].u.shm_dtime,
> -                           shmids[id].u.shm_ctime,
> +                           (long)shmids[id].u.shm_atime,
> +                           (long)shmids[id].u.shm_dtime,
> +                           (long)shmids[id].u.shm_ctime,
>                             0, 0);      /* XXX rss & swp are not supported
> */
>
>         free(shmids, M_TEMP);
>