diff options
author | jhb <jhb@FreeBSD.org> | 2005-07-07 19:17:55 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2005-07-07 19:17:55 +0000 |
commit | d7828dd231a73e90e0fa9ba30e01f45d81bb7b9a (patch) | |
tree | 8449c41e367ecdde698b3e7eaa870b1a82ae1b8f /sys/compat/linux/linux_misc.c | |
parent | 43340a2b9eb2ef712c449a62e7cd066b59fec068 (diff) | |
download | FreeBSD-src-d7828dd231a73e90e0fa9ba30e01f45d81bb7b9a.zip FreeBSD-src-d7828dd231a73e90e0fa9ba30e01f45d81bb7b9a.tar.gz |
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)
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index e72c528..eb9115d 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++) |