[git commit] preparatory patch

Denys Vlasenko vda.linux at googlemail.com
Sat May 7 02:37:22 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=c3f8db99bf91e6fb131c8d2240fc4d5a44ed561a
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 procps/iostat.c |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/procps/iostat.c b/procps/iostat.c
index 06a33eb..28bf4de 100644
--- a/procps/iostat.c
+++ b/procps/iostat.c
@@ -128,6 +128,23 @@ static void print_timestamp(void)
 	printf("%s\n", buf);
 }
 
+static cputime_t get_smp_uptime(void)
+{
+	FILE *fp;
+	char buf[sizeof(long)*3 * 2 + 4];
+	unsigned long sec, dec;
+
+	fp = xfopen_for_read("/proc/uptime");
+
+	if (fgets(buf, sizeof(buf), fp))
+		if (sscanf(buf, "%lu.%lu", &sec, &dec) != 2)
+			bb_error_msg_and_die("can't read /proc/uptime");
+
+	fclose(fp);
+
+	return (cputime_t)sec * G.clk_tck + dec * G.clk_tck / 100;
+}
+
 /* Fetch CPU statistics from /proc/stat */
 static void get_cpu_statistics(struct stats_cpu *sc)
 {
@@ -153,23 +170,6 @@ static void get_cpu_statistics(struct stats_cpu *sc)
 	fclose(fp);
 }
 
-static cputime_t get_smp_uptime(void)
-{
-	FILE *fp;
-	char buf[sizeof(long)*3 * 2 + 4];
-	unsigned long sec, dec;
-
-	fp = xfopen_for_read("/proc/uptime");
-
-	if (fgets(buf, sizeof(buf), fp))
-		if (sscanf(buf, "%lu.%lu", &sec, &dec) != 2)
-			bb_error_msg_and_die("can't read /proc/uptime");
-
-	fclose(fp);
-
-	return (cputime_t)sec * G.clk_tck + dec * G.clk_tck / 100;
-}
-
 /*
  * Obtain current uptime in jiffies.
  * Uptime is sum of individual CPUs' uptimes.
@@ -507,11 +507,12 @@ int iostat_main(int argc, char **argv)
 
 	/* Store device names into device list */
 	while (*argv && !isdigit(*argv[0])) {
-		if (strcmp(*argv, "ALL") != 0)
+		if (strcmp(*argv, "ALL") != 0) {
 			/* If not ALL, save device name */
 			save_to_devlist(*argv);
-		else
+		} else {
 			G.show_all = 1;
+		}
 		argv++;
 	}
 
-- 
1.7.3.4



More information about the busybox-cvs mailing list