sysinfo: Use timespec64 accessors for calculating uptime
RFC PATCH 1/1 sysinfo: Use timespec64 accessors for calculating uptime
As part of the y2038 effort, convert sysinfo's uptime calculation to use the timespec64 based accessor.
Uptime isn't likely to ever exceed a s32, so this doesn't actually bring much in the way of change, but it is done for consistency sake as we deprecate 32bit internal interfaces.
Cc Arnd Bergmann <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Serge Hallyn <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Alex Thorlton <[email protected]>
Cc "vishnu.ps" <[email protected]>
Signed-off-by John Stultz <[email protected]>
--- kernel/sys.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/sys.c +7 -3
@@ -2260,12 +2260,16 @@ static int do_sysinfo(struct sysinfo *info) {unsigned long mem_total, sav_total;unsigned int mem_unit, bitcount; -struct timespec tp; +struct timespec64 tp;memset (info,0 ,sizeof (struct sysinfo )); -get_monotonic_boottime (&tp); - info->uptime = tp.tv_sec + (tp.tv_nsec ?1 :0 ); +get_monotonic_boottime64 (&tp); +/* +* y2038: uptime is unlikely to ever grow beyond an s32 +* so this cast to a long shouldn't be an issue. +*/ + info->uptime = (long )tp.tv_sec + (tp.tv_nsec ?1 :0 );get_avenrun (info->loads,0 ,SI_LOAD_SHIFT -FSHIFT );
Signature · 1 line
1.9.1