Commit Graph

7 Commits

Author SHA1 Message Date
Jim Warner
34395be330 library: suppress zero 'days' under the <uptime.h> API
The former whattime logic used to suppress that 'days'
output when the system had been up less than 24 hours.

But since the refactor for newlib, '0 days' was always
output under those conditions. So this commit restores
the former expected behavior of suppressing that item.

[ plus an erroneous calculation of uphours was fixed ]

[ and the clang warnings shown below were also fixed ]

Reference(s):
proc/uptime.c:74:10: warning: unused variable 'buf' [-Wunused-variable]
    char buf[256];
         ^
proc/uptime.c:131:58: warning: data argument not used by format string [-Wformat-extra-args]
        pos += sprintf(upbuf + pos, "%d min, ", uphours, upminutes);
                                    ~~~~~~~~~~           ^
proc/uptime.c:175:15: warning: expression result unused [-Wunused-value]
        comma +1;
        ~~~~~ ^~

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-09-06 21:59:17 +10:00
Craig Small
c3e85cef73 library: loadavg change to procps_loadavg 2015-07-01 21:47:30 +10:00
Jim Warner
336748ecc0 misc: remove yet more darn trailing whitespace buildup
Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-07-01 21:28:22 +10:00
Craig Small
639daf5468 library: Update uptime calls to standard format
Changed all the uptime related functions to use the
standard naming procps_uptime_*
2015-06-29 22:09:59 +10:00
Craig Small
cbf25b93e3 library: more mem and stat fixes
Make distcheck now succeeds.
Changed some of the binaries to use the new API.
2015-06-26 22:37:29 +10:00
Craig Small
05efbebb66 library: Fix up stat API
Adjusted vmstat to use the new API for memory and CPU statistics
2015-06-26 22:37:28 +10:00
Craig Small
d7932b9a13 library: uptime API changes
Removed the printf_uptime, binaries can do printf easily enough.
sprint_uptime split into two as there wasn't a lot of common
code
 sprint_uptime(): old style uptime line
 sprint_uptime_short(): short new style "uptime -p"

Hertz_hack needed this, no sane system uses the code (I think)
so just assume 100 like we do in FreeBSD.
2015-06-26 22:37:28 +10:00