[PATCH v4 1/8] kernel_rusage.h: Add a internal rusage struct

Dmitry V. Levin ldv at altlinux.org
Tue Mar 10 01:35:22 UTC 2020


On Mon, Mar 09, 2020 at 05:42:57PM -0700, Alistair Francis wrote:
> Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
> ---
>  kernel_rusage.h | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>  create mode 100644 kernel_rusage.h
> 
> diff --git a/kernel_rusage.h b/kernel_rusage.h
> new file mode 100644
> index 00000000..0c8d5a57
> --- /dev/null
> +++ b/kernel_rusage.h
> @@ -0,0 +1,32 @@
> +/*
> + * Copyright (c) 2020 Western Digital.
> + * 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;
> +} rusage_t;

Isn't it exactly the same structure as already defined in printrusage.c?
Why not move the definition into the new header instead of creating two
copies of the same definition?

If the header file has "kernel_" prefix, I wouldn't be surprised if you
added the same prefix to the new type.


-- 
ldv


More information about the Strace-devel mailing list