aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-01-05 18:39:23 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-01-05 18:39:23 +0100
commit1ec49732e2b477c45599f1a33953b4390e8c43e5 (patch)
tree02add593276da4506c44de99264cd32c80bc5321
parent75a1403f266098bc4a498140473e1007075f459d (diff)
downloadbusybox-1ec49732e2b477c45599f1a33953b4390e8c43e5.tar.gz
mpstat: code shrink
function old new delta get_uptime 134 129 -5 get_irqs_from_stat 110 103 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--procps/mpstat.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/procps/mpstat.c b/procps/mpstat.c
index c628d6215..af3263d67 100644
--- a/procps/mpstat.c
+++ b/procps/mpstat.c
@@ -522,9 +522,7 @@ static void get_irqs_from_stat(struct stats_irq *irq)
FILE *fp;
char buf[1024];
- fp = fopen_for_read(PROCFS_STAT);
- if (!fp)
- return;
+ fp = xfopen_for_read(PROCFS_STAT);
while (fgets(buf, sizeof(buf), fp)) {
//bb_error_msg("/proc/stat:'%s'", buf);
@@ -644,9 +642,7 @@ static void get_uptime(data_t *uptime)
char buf[sizeof(long)*3 * 2 + 4]; /* enough for long.long */
unsigned long uptime_sec, decimal;
- fp = fopen_for_read(PROCFS_UPTIME);
- if (!fp)
- return;
+ fp = xfopen_for_read(PROCFS_UPTIME);
if (fgets(buf, sizeof(buf), fp)) {
if (sscanf(buf, "%lu.%lu", &uptime_sec, &decimal) == 2) {
*uptime = (data_t)uptime_sec * G.hz + decimal * G.hz / 100;