[PATCH v5 01/12] kernel_rusage.h: Add a internal rusage struct

Alistair Francis alistair.francis at wdc.com
Thu Mar 12 17:55:12 UTC 2020


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.
+ * 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;
+
+#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



More information about the Strace-devel mailing list