]> granicus.if.org Git - procps-ng/commit
library: procps_uptime() return value is a status
authorCraig Small <csmall@enc.com.au>
Sun, 1 May 2016 06:50:25 +0000 (16:50 +1000)
committerCraig Small <csmall@enc.com.au>
Sun, 1 May 2016 06:50:25 +0000 (16:50 +1000)
commit6b5cb345c5be6beeec74409657c8ebf9e8869d92
treee81c7e821c6afa02b417ca6a3d10cbcfdbdbb503
parent6151b794c6a4f1958dee81fb17bad83b65166c8f
library: procps_uptime() return value is a status

procps_uptime, previously just plain uptime() used to put the
uptime (as a double) in the first argument and return uptime
(as an int).

It meant if you ran
 myuptime2 = procps_uptime(&myuptime1, NULL);
You might get different results for myuptime1 and myuptime2 because
they are different types.

Most library calls use the return value to return the status,
procps_uptime was in the middle.

Until now.

This function will return 0 on success. If you want (for whatever
reason) uptime as an int then cast it.

All of the procps binaries didn't use the return value for uptime
except ps which set a variable to it but never used it anywhere.
doc/procps_uptime.3
proc/test_uptime.c
proc/uptime.c
ps/common.h
ps/global.c