commit 46d2121960d81354facf4e2558c81f82257b740e Author: Dave Anderson Date: Tue May 29 14:04:03 2018 -0400 Fix for the "timer -r" command on Linux 4.10 and later kernels that contain commit 2456e855354415bfaeb7badaa14e11b3e02c8466, titled "ktime: Get rid of the union". Without the patch, the command fails with the error message "timer: invalid structure member offset: ktime_t_sec". (k-hagio@ab.jp.nec.com) diff --git a/kernel.c b/kernel.c index b1886ce..138a47f 100644 --- a/kernel.c +++ b/kernel.c @@ -7740,7 +7740,7 @@ ktime_to_ns(const void *ktime) if (VALID_MEMBER(ktime_t_tv64)) { readmem((ulong)ktime + OFFSET(ktime_t_tv64), KVADDR, &ns, sizeof(ns), "ktime_t tv64", QUIET|RETURN_ON_ERROR); - } else { + } else if (VALID_MEMBER(ktime_t_sec) && VALID_MEMBER(ktime_t_nsec)) { uint32_t sec, nsec; sec = 0; @@ -7753,6 +7753,9 @@ ktime_to_ns(const void *ktime) sizeof(nsec), "ktime_t nsec", QUIET|RETURN_ON_ERROR); ns = sec * 1000000000L + nsec; + } else { + readmem((ulong)ktime, KVADDR, &ns, + sizeof(ns), "ktime_t", QUIET|RETURN_ON_ERROR); } return ns;