[PATCH v3 2/4] printrusage: Correctly print the long types from the rusage struct

Dmitry V. Levin ldv at altlinux.org
Sat Mar 7 13:59:18 UTC 2020


On Fri, Mar 06, 2020 at 08:35:58PM -0800, Alistair Francis wrote:
>  On Fri, Mar 6, 2020 at 7:12 PM Dmitry V. Levin <ldv at altlinux.org> wrote:
[...]
> > Yet again, I don't understand why do we need yet another printer.
> >
> > Since there are no architectures where kernel definitions of struct timeval
> > and struct __kernel_old_timeval wouldn't match, print_timeval_t should be
> 
> They don't match for RV32 (and all y2038 safe architectures).
> 
> > enough if timeval_t is defined correctly.
> 
> I don't know how it could be defined to print both as 32-bit y2038
> safe archs have a 32-bit and 64-bit timeval.
> 
> > In other words, if you need print_old_timeval_t, then print_timeval_t
> > is already broken.
> 
> It's not completely broken, there are just two different timeval structs.

The kernel does not use struct timeval nowadays.

There is a struct __kernel_sock_timeval which is a purely 64-bit
structure, strace handles it using functions defined in print_timeval64.c.

There is a struct __kernel_old_timeval which is a replacement for the
former struct timeval, strace handles it using functions defined in
print_timeval.c.

There is also a struct old_timeval32 used in compat syscalls, strace
handles it using functions defined in -m32 mpers mode of print_timeval.c.


-- 
ldv


More information about the Strace-devel mailing list