svn commit: trunk/busybox/procps

vda at busybox.net vda at busybox.net
Sat Sep 9 12:55:02 UTC 2006


Author: vda
Date: 2006-09-09 05:55:02 -0700 (Sat, 09 Sep 2006)
New Revision: 16084

Log:
top: fixed wrong comment, made error message more clear



Modified:
   trunk/busybox/procps/top.c


Changeset:
Modified: trunk/busybox/procps/top.c
===================================================================
--- trunk/busybox/procps/top.c	2006-09-09 12:49:03 UTC (rev 16083)
+++ trunk/busybox/procps/top.c	2006-09-09 12:55:02 UTC (rev 16084)
@@ -76,7 +76,7 @@
 }
 
 /* This structure stores some critical information from one frame to
-   the next. mostly used for sorting. Added cumulative and resident fields. */
+   the next. Mostly used for sorting. */
 struct save_hist {
 	int ticks;
 	int pid;
@@ -108,7 +108,7 @@
 	if (fscanf(fp, "cpu  %lld %lld %lld %lld %lld %lld %lld %lld",
 			&jif.usr,&jif.nic,&jif.sys,&jif.idle,
 			&jif.iowait,&jif.irq,&jif.softirq,&jif.steal) < 4) {
-		bb_error_msg_and_die("failed to read 'stat'");
+		bb_error_msg_and_die("failed to read /proc/stat");
 	}
 	fclose(fp);
 	jif.total = jif.usr + jif.nic + jif.sys + jif.idle
@@ -392,22 +392,18 @@
 #endif /* CONFIG_FEATURE_USE_TERMIOS */
 
 	/* do normal option parsing */
+	interval = 5;
 	opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval);
-	if ((opt & 1)) {
+	if (opt & 1)
 		interval = atoi(sinterval);
-	} else {
-		/* Default update rate is 5 seconds */
-		interval = 5;
-	}
 
 	/* change to /proc */
 	xchdir("/proc");
 #ifdef CONFIG_FEATURE_USE_TERMIOS
 	tcgetattr(0, (void *) &initial_settings);
 	memcpy(&new_settings, &initial_settings, sizeof(struct termios));
-	new_settings.c_lflag &= ~(ISIG | ICANON); /* unbuffered input */
-	/* Turn off echoing */
-	new_settings.c_lflag &= ~(ECHO | ECHONL);
+	/* unbuffered input, turn off echo */
+	new_settings.c_lflag &= ~(ISIG | ICANON | ECHO | ECHONL);
 
 	signal(SIGTERM, sig_catcher);
 	signal(SIGINT, sig_catcher);




More information about the busybox-cvs mailing list