[PATCH v6 01/13] kernel_rusage.h: Add a internal rusage struct

Alistair Francis alistair23 at gmail.com
Wed Apr 1 17:35:31 UTC 2020


On Tue, Mar 31, 2020 at 4:38 PM Dmitry V. Levin <ldv at altlinux.org> wrote:
>
> On Fri, Mar 20, 2020 at 03:09:27PM -0700, Alistair Francis wrote:
> > Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> > ---
> >  Makefile.am     |  1 +
> >  kernel_rusage.h | 34 ++++++++++++++++++++++++++++++++++
> >  printrusage.c   | 20 +-------------------
> >  3 files changed, 36 insertions(+), 19 deletions(-)
> >  create mode 100644 kernel_rusage.h
> >
> > diff --git a/Makefile.am b/Makefile.am
> > index fe3a2c1a..cf45d952 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -168,6 +168,7 @@ strace_SOURCES =  \
> >       kernel_timeval.h \
> >       kernel_timex.h  \
> >       kernel_types.h  \
> > +     kernel_rusage.h \
> >       kexec.c         \
> >       keyctl.c        \
> >       keyctl_kdf_params.h \
> > diff --git a/kernel_rusage.h b/kernel_rusage.h
> > new file mode 100644
> > index 00000000..0092af9b
> > --- /dev/null
> > +++ b/kernel_rusage.h
> > @@ -0,0 +1,34 @@
> > +/*
> > + * Copyright (c) 2020 Western Digital.
>
> With all due respect, I'm not sure this patch (that just moves
> the definition of a structure to a separate file) contains
> enough legally significant changes to claim the copyright.

Good point, removed.

>
> > + * All rights reserved.
> > + *
> > + * SPDX-License-Identifier: LGPL-2.1-or-later
> > + */
> > +
> > +#ifndef STRACE_KERNEL_RUSAGE_H
> > +# define STRACE_KERNEL_RUSAGE_H
> > +
> > +# include "kernel_timeval.h"
> > +
> > +typedef struct {
> > +       kernel_old_timeval_t ru_utime;
> > +       kernel_old_timeval_t ru_stime;
> > +       kernel_long_t   ru_maxrss;
> > +       kernel_long_t   ru_ixrss;
> > +       kernel_long_t   ru_idrss;
> > +       kernel_long_t   ru_isrss;
> > +       kernel_long_t   ru_minflt;
> > +       kernel_long_t   ru_majflt;
> > +       kernel_long_t   ru_nswap;
> > +       kernel_long_t   ru_inblock;
> > +       kernel_long_t   ru_oublock;
> > +       kernel_long_t   ru_msgsnd;
> > +       kernel_long_t   ru_msgrcv;
> > +       kernel_long_t   ru_nsignals;
> > +       kernel_long_t   ru_nvcsw;
> > +       kernel_long_t   ru_nivcsw;
> > +} kernel_rusage_t;
> > +
> > +typedef kernel_rusage_t rusage_t;
>
> I don't think we need rusage_t after this move.
> Those two places in printrusage.c that reference rusage_t
> could be easily updated to use kernel_rusage_t instead.

Removed as well.

Alistair

>
> > +
> > +#endif /* !STRACE_KERNEL_RUSAGE_H */
> > diff --git a/printrusage.c b/printrusage.c
> > index 2d134b9d..76dd1d9b 100644
> > --- a/printrusage.c
> > +++ b/printrusage.c
> > @@ -14,25 +14,7 @@
> >  #include DEF_MPERS_TYPE(rusage_t)
> >
> >  #include "kernel_timeval.h"
> > -
> > -typedef struct {
> > -     kernel_old_timeval_t ru_utime;
> > -     kernel_old_timeval_t ru_stime;
> > -     kernel_long_t   ru_maxrss;
> > -     kernel_long_t   ru_ixrss;
> > -     kernel_long_t   ru_idrss;
> > -     kernel_long_t   ru_isrss;
> > -     kernel_long_t   ru_minflt;
> > -     kernel_long_t   ru_majflt;
> > -     kernel_long_t   ru_nswap;
> > -     kernel_long_t   ru_inblock;
> > -     kernel_long_t   ru_oublock;
> > -     kernel_long_t   ru_msgsnd;
> > -     kernel_long_t   ru_msgrcv;
> > -     kernel_long_t   ru_nsignals;
> > -     kernel_long_t   ru_nvcsw;
> > -     kernel_long_t   ru_nivcsw;
> > -} rusage_t;
> > +#include "kernel_rusage.h"
> >
> >  #include MPERS_DEFS
> >
> > --
> > 2.25.1
>
> --
> ldv


More information about the Strace-devel mailing list