Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700079

Re: [PATCH v2 4/6] ipc: sem: Make sem_array timestamps y2038 safe

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH v2 4/6] ipc: sem: Make sem_array timestamps y2038 safe
Date 2017-07-31 16:20 +0200
Message-ID <u9jI6-7iZ-9@gated-at.bofh.it> (permalink)
References <u952p-6hY-9@gated-at.bofh.it> <u952q-6hY-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jul 31, 2017 at 12:30 AM, Deepa Dinamani <deepa.kernel@gmail.com> wrote:
> time_t is not y2038 safe. Replace all uses of
> time_t by y2038 safe time64_t.
>
> Similarly, replace the calls to get_seconds() with
> y2038 safe ktime_get_real_seconds().
> Note that this preserves fast access on 64 bit systems,
> but 32 bit systems need sequence counters.
>
> The syscall interface themselves are not changed as part of
> the patch. They will be part of a different series.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>

Looks good. One detail:

> @@ -2310,7 +2310,7 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
>         sem_otime = get_semotime(sma);
>
>         seq_printf(s,
> -                  "%10d %10d  %4o %10u %5u %5u %5u %5u %10lu %10lu\n",
> +                  "%10d %10d  %4o %10u %5u %5u %5u %5u %10llu %10llu\n",
>                    sma->sem_perm.key,
>                    sma->sem_perm.id,
>                    sma->sem_perm.mode,
> @@ -2319,8 +2319,8 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
>                    from_kgid_munged(user_ns, sma->sem_perm.gid),
>                    from_kuid_munged(user_ns, sma->sem_perm.cuid),
>                    from_kgid_munged(user_ns, sma->sem_perm.cgid),
> -                  sem_otime,
> -                  sma->sem_ctime);
> +                  (unsigned long long) sem_otime,
> +                  (unsigned long long) sma->sem_ctime);
>

Unless I'm missing something here, you can drop the cast to
unsigned long long: time64_t is always 'long long' and won't
cause a warning here.

We only need a cast like this when printing the members of 'struct
 timespec64', since that can be either 'long long' or 'long', when
it is defined as an alias for timespec.

        Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] Make ipc y2038 safe Deepa Dinamani <deepa.kernel@gmail.com> - 2017-07-31 00:40 +0200
  [PATCH v2 2/6] ipc: mqueue: Replace timespec with timespec64 Deepa Dinamani <deepa.kernel@gmail.com> - 2017-07-31 00:40 +0200
    Re: [PATCH v2 2/6] ipc: mqueue: Replace timespec with timespec64 Paul Moore <paul@paul-moore.com> - 2017-08-01 01:10 +0200
      Re: [PATCH v2 2/6] ipc: mqueue: Replace timespec with timespec64 Deepa Dinamani <deepa.kernel@gmail.com> - 2017-08-02 00:40 +0200
  [PATCH v2 3/6] ipc: msg: Make msg_queue timestamps y2038 safe Deepa Dinamani <deepa.kernel@gmail.com> - 2017-07-31 00:40 +0200
    Re: [PATCH v2 3/6] ipc: msg: Make msg_queue timestamps y2038 safe Arnd Bergmann <arnd@arndb.de> - 2017-07-31 16:20 +0200
  [PATCH v2 1/6] ipc: Make sys_semtimedop() y2038 safe Deepa Dinamani <deepa.kernel@gmail.com> - 2017-07-31 00:40 +0200
  [PATCH v2 5/6] ipc: shm: Make shmid_kernel timestamps y2038 safe Deepa Dinamani <deepa.kernel@gmail.com> - 2017-07-31 00:40 +0200
  [PATCH v2 6/6] utimes: Make utimes y2038 safe Deepa Dinamani <deepa.kernel@gmail.com> - 2017-07-31 00:40 +0200
  [PATCH v2 4/6] ipc: sem: Make sem_array timestamps y2038 safe Deepa Dinamani <deepa.kernel@gmail.com> - 2017-07-31 00:40 +0200
    Re: [PATCH v2 4/6] ipc: sem: Make sem_array timestamps y2038 safe Arnd Bergmann <arnd@arndb.de> - 2017-07-31 16:20 +0200
      Re: [PATCH v2 4/6] ipc: sem: Make sem_array timestamps y2038 safe Deepa Dinamani <deepa.kernel@gmail.com> - 2017-08-02 00:40 +0200
  Re: [PATCH v2 0/6] Make ipc y2038 safe Arnd Bergmann <arnd@arndb.de> - 2017-07-31 16:20 +0200

csiph-web