[PATCH v4 4/8] kernel_timespec.h: Add a kernel_timespec_t struct

Alistair Francis alistair23 at gmail.com
Tue Mar 10 18:52:38 UTC 2020


On Tue, Mar 10, 2020 at 11:58 AM Dmitry V. Levin <ldv at altlinux.org> wrote:
>
> On Tue, Mar 10, 2020 at 11:15:12AM -0700, Alistair Francis wrote:
> > On Mon, Mar 9, 2020 at 6:49 PM Dmitry V. Levin <ldv at altlinux.org> wrote:
> > >
> > > On Mon, Mar 09, 2020 at 05:43:00PM -0700, Alistair Francis wrote:
> > > > Add a kernel_timespec_t struct based on the definition in the Linux
> > > > kernel locatied at include/uapi/linux/time.h.
> > > >
> > > > Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > > > ---
> > > >  kernel_timespec.h | 5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > >
> > > > diff --git a/kernel_timespec.h b/kernel_timespec.h
> > > > index 90133f8d..0d541333 100644
> > > > --- a/kernel_timespec.h
> > > > +++ b/kernel_timespec.h
> > > > @@ -22,4 +22,9 @@ typedef struct {
> > > >
> > > >  # endif /* HAVE_ARCH_TIME32_SYSCALLS */
> > > >
> > > > +typedef struct {
> > > > +     kernel_long_t tv_sec;
> > > > +     long tv_nsec;
> > > > +} kernel_timespec_t;
> > > > +
> > > >  #endif /* !STRACE_KERNEL_TIMESPEC_H */
> > >
> > > Sorry but this doesn't match struct __kernel_timespec.
> >
> > This is supposed to match __kernel_old_timespec, which I just noticed
> > they added recently.
>
> If this is called kernel_timespec_t, it would cause confusion because
> it matches __kernel_old_timespec and it doesn't match __kernel_timespec.

I have updated the series to use kernel_old_timespec. Sorry about that
confusion, I was looking at the 5.4 kernel tree which doesn't have
kernel_old_timespec.

>
> > > Anyway, I don't see any need to use this structure in strace itself.
> > > Maybe we could employ it in tests where we currently use struct
> > > __kernel_timespec.
> >
> > We can, but then how do we print the values out?
>
> We just print them.

That works in the tests, but not in strace (see my other reply).

Alistair

>
>
> --
> ldv


More information about the Strace-devel mailing list