[PATCH v4 3/8] timespec32: Rename to old_timespec32

Alistair Francis alistair23 at gmail.com
Tue Mar 10 18:32:24 UTC 2020


On Tue, Mar 10, 2020 at 11:34 AM Dmitry V. Levin <ldv at altlinux.org> wrote:
>
> On Tue, Mar 10, 2020 at 11:04:54AM -0700, Alistair Francis wrote:
> > On Mon, Mar 9, 2020 at 6:44 PM Dmitry V. Levin <ldv at altlinux.org> wrote:
> > > On Mon, Mar 09, 2020 at 05:42:59PM -0700, Alistair Francis wrote:
> > > > The Linux kernel calls the 32-bit timespec struct old_timespec32, so
> > > > let's rename it to be clear.
> > >
> > > I don't find old_timespec32 any more clear than timespec32, sorry.
> > > Why add a prefix when the suffix is quite descriptive already?
> >
> > The main reason is just to be explicitly clear.
> >
> > There are three timespecs in the Linux kernel:
> >  - timespec64 - include/linux/time64.h
> >     - This one gives a 64-bit version for all systems
> >  - old_timespec32 - include/linux/time64.h
> >     - This is only used on old 32-bit systems (with *_time32 syscalls)
> >  - timespec - include/uapi/linux/time.h
> >     - This is used for some syscalls (as seen in this series).
> >     - On 32-bit systems this is a 32-bit value (no matter what size
> > time_t is) so it can be confused with the current strace timespec32
> > (although it's not the same).
>
> Sorry, I don't follow.  Isn't it either kernel_timespec64_t or
> kernel_timespec32_t in every case?  Could you give an example where
> it doesn't match neither kernel_timespec64_t nor kernel_timespec32_t?

The timespec here is the same as the struct __kernel_old_timespec.

For 32-bit systems __kernel_old_timespec and kernel_timespec32_t will
end up being the same, but the definitions are different.

struct timespec {
    __kernel_old_time_t    tv_sec;        /* seconds */
    long            tv_nsec;    /* nanoseconds */
};

AND

typedef s32        old_time32_t;

struct old_timespec32 {
    old_time32_t    tv_sec;
    s32        tv_nsec;
};

On top of that kernel_timespec32_t isn't defined for new 32-bit arches
(like RV32) as it doesn't have HAVE_ARCH_TIME32_SYSCALLS. So we can
either use kernel_timespec32_t (even though it doesn't actually match)
or add a new kernel_old_timespec_t.

Alistair

>
>
> --
> ldv


More information about the Strace-devel mailing list