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)
This commit is contained in:
John Baldwin 2005-07-07 19:17:55 +00:00
parent a146c8c620
commit 8d948cd1ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=147816

View file

@ -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++)