[PATCH v7 07/14] print_timespec: Print the 32-bit timespec for HAVE_ARCH_TIMESPEC32

Alistair Francis alistair.francis at wdc.com
Fri Apr 17 16:47:17 UTC 2020


When printing
print_struct_timespec_data_size/print_struct_timespec_array_data_size
print the 32-bit version if HAVE_ARCH_TIMESPEC32 is set to 1.

Signed-off-by: Alistair Francis <alistair.francis at wdc.com>
---
 defs.h             | 4 ++--
 kernel_timespec.h  | 2 +-
 print_timespec.c   | 8 ++++++++
 print_timespec32.c | 4 ++--
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/defs.h b/defs.h
index 0968bc35..f79415a7 100644
--- a/defs.h
+++ b/defs.h
@@ -1327,7 +1327,7 @@ tprint_iov(struct tcb *tcp, kernel_ulong_t len, kernel_ulong_t addr,
 	tprint_iov_upto(tcp, len, addr, decode_iov, -1);
 }
 
-# if HAVE_ARCH_TIME32_SYSCALLS
+#if HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_TIMESPEC32
 extern bool print_timespec32_data_size(const void *arg, size_t size);
 extern bool print_timespec32_array_data_size(const void *arg,
 					     unsigned int nmemb,
@@ -1337,7 +1337,7 @@ extern const char *sprint_timespec32(struct tcb *, kernel_ulong_t);
 extern int print_timespec32_utime_pair(struct tcb *, kernel_ulong_t);
 extern int print_itimerspec32(struct tcb *, kernel_ulong_t);
 extern int print_timex32(struct tcb *, kernel_ulong_t);
-# endif /* HAVE_ARCH_TIME32_SYSCALLS */
+# endif /* HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_TIMESPEC32 */
 
 extern bool print_timespec64_data_size(const void *arg, size_t size);
 extern bool print_timespec64_array_data_size(const void *arg,
diff --git a/kernel_timespec.h b/kernel_timespec.h
index 49ba86d8..583d1af0 100644
--- a/kernel_timespec.h
+++ b/kernel_timespec.h
@@ -13,7 +13,7 @@ typedef struct {
 	long long tv_nsec;
 } kernel_timespec64_t;
 
-# if HAVE_ARCH_TIME32_SYSCALLS
+# if HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_TIMESPEC32
 
 typedef struct {
 	int tv_sec;
diff --git a/print_timespec.c b/print_timespec.c
index 5b353cea..aa71ef2d 100644
--- a/print_timespec.c
+++ b/print_timespec.c
@@ -37,12 +37,20 @@ typedef kernel_timespec64_t timespec_t;
 MPERS_PRINTER_DECL(bool, print_struct_timespec_data_size,
 		   const void *arg, const size_t size)
 {
+#if HAVE_ARCH_TIMESPEC32
+	return print_timespec32_data_size(arg, size);
+#else
 	return PRINT_TIMESPEC_DATA_SIZE(arg, size);
+#endif
 }
 
 MPERS_PRINTER_DECL(bool, print_struct_timespec_array_data_size,
 		   const void *arg, const unsigned int nmemb,
 		   const size_t size)
 {
+#if HAVE_ARCH_TIMESPEC32
+	return print_timespec32_array_data_size(arg, nmemb, size);
+#else
 	return PRINT_TIMESPEC_ARRAY_DATA_SIZE(arg, nmemb, size);
+#endif
 }
diff --git a/print_timespec32.c b/print_timespec32.c
index f6a16bc9..1ce7949d 100644
--- a/print_timespec32.c
+++ b/print_timespec32.c
@@ -7,7 +7,7 @@
 
 #include "defs.h"
 
-#if HAVE_ARCH_TIME32_SYSCALLS
+#if HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_TIMESPEC32
 
 # define TIMESPEC_T kernel_timespec32_t
 # define PRINT_TIMESPEC_DATA_SIZE print_timespec32_data_size
@@ -20,4 +20,4 @@
 # include "kernel_timespec.h"
 # include "print_timespec.h"
 
-#endif /* HAVE_ARCH_TIME32_SYSCALLS */
+#endif /* HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_TIMESPEC32 */
-- 
2.26.0



More information about the Strace-devel mailing list