From 4ad1e409011cfcc50fc84a7658e8e35fc2c854d6 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Fri, 10 May 2019 22:27:59 +0000 Subject: [PATCH] sparc64: implement printer for sparc64-specific struct timex According to Linux kernel commit v5.1-rc1~160^2~2^2~8, sparc64 is the only architecture on Linux that has a 'timeval' definition with a 32-bit tv_usec but a 64-bit tv_sec. * defs.h [SPARC64] (print_sparc64_timex): New prototype. * kernel_timex.h [SPARC64] (kernel_sparc64_timex_t): New type. * print_timex.c [SPARC64] (print_sparc64_timex): New function. --- defs.h | 4 ++++ kernel_timex.h | 34 ++++++++++++++++++++++++++++++++++ print_timex.c | 10 ++++++++++ 3 files changed, 48 insertions(+) diff --git a/defs.h b/defs.h index 1cb7a755..a3263369 100644 --- a/defs.h +++ b/defs.h @@ -1131,6 +1131,10 @@ extern int print_timespec64_utime_pair(struct tcb *, kernel_ulong_t); extern int print_itimerspec64(struct tcb *, kernel_ulong_t); extern int print_timex64(struct tcb *, kernel_ulong_t); +# ifdef SPARC64 +extern int print_sparc64_timex(struct tcb *, kernel_ulong_t); +# endif + # ifdef ALPHA typedef struct { int tv_sec, tv_usec; diff --git a/kernel_timex.h b/kernel_timex.h index ea77e1da..6eff047f 100644 --- a/kernel_timex.h +++ b/kernel_timex.h @@ -38,6 +38,40 @@ typedef struct { int pad3[11]; } kernel_timex64_t; +#ifdef SPARC64 + +typedef struct { + unsigned int modes; + int pad0; + long long offset; + long long freq; + long long maxerror; + long long esterror; + int status; + int pad1; + long long constant; + long long precision; + long long tolerance; + struct { + long long tv_sec; + int tv_usec; + } time; + long long tick; + long long ppsfreq; + long long jitter; + int shift; + int pad2; + long long stabil; + long long jitcnt; + long long calcnt; + long long errcnt; + long long stbcnt; + int tai; + int pad3[11]; +} kernel_sparc64_timex_t; + +#endif /* SPARC64 */ + # if HAVE_ARCH_TIME32_SYSCALLS typedef struct { diff --git a/print_timex.c b/print_timex.c index 9c0f0941..98d13525 100644 --- a/print_timex.c +++ b/print_timex.c @@ -72,4 +72,14 @@ MPERS_PRINTER_DECL(int, print_timex, # endif /* HAVE_ARCH_TIME32_SYSCALLS */ +# ifdef SPARC64 + +# define PRINT_TIMEX print_sparc64_timex +# define TIMEX_T kernel_sparc64_timex_t +# include "print_timex.h" +# undef TIMEX_T +# undef PRINT_TIMEX + +# endif /* SPARC64 */ + #endif /* !IN_MPERS */ -- 2.40.0