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

Dmitry V. Levin ldv at altlinux.org
Sun Apr 19 22:12:10 UTC 2020


On Fri, Apr 17, 2020 at 09:47:17AM -0700, Alistair Francis wrote:
> 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(-)
[...]
> --- 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
>  }

Many 64-bit architectures including x86-64 have HAVE_ARCH_TIMESPEC32
defined to 1 because they have personality with sizeof(kernel_long_t) == 4,
so this patch would break all of them.

I've applied a different patch instead, at least it doesn't break anything
I could test.  Please test it on your architecture.


-- 
ldv


More information about the Strace-devel mailing list