From 8d948cd1ec9917186c8356f87969bf8afc768717 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 7 Jul 2005 19:17:55 +0000 Subject: [PATCH] Fix the computation of uptime for linux_sysinfo(). Before it was returning the uptime in seconds mod 60 which wasn't very useful. Approved by: re (scottl) --- sys/compat/linux/linux_misc.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index e72c528a33b..eb9115d7f00 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -131,22 +131,10 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) int i, j; struct timespec ts; - /* Uptime is copied out of print_uptime() in kern_shutdown.c */ getnanouptime(&ts); - i = 0; - if (ts.tv_sec >= 86400) { - ts.tv_sec %= 86400; - i = 1; - } - if (i || ts.tv_sec >= 3600) { - ts.tv_sec %= 3600; - i = 1; - } - if (i || ts.tv_sec >= 60) { - ts.tv_sec %= 60; - i = 1; - } - sysinfo.uptime=ts.tv_sec; + if (ts.tv_nsec != 0) + ts.tv_sec++; + sysinfo.uptime = ts.tv_sec; /* Use the information from the mib to get our load averages */ for (i = 0; i < 3; i++)