summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenis Vlasenko2006-09-09 12:55:02 +0000
committerDenis Vlasenko2006-09-09 12:55:02 +0000
commit42dfcd261204e8a055a41437679858e9fc9226e0 (patch)
tree55e211be7c237ea2116e4f13da164e4cb6c30834 /procps
parent0c45bb23d21f6b3b8a371043fac7403790d57b20 (diff)
downloadbusybox-42dfcd261204e8a055a41437679858e9fc9226e0.zip
busybox-42dfcd261204e8a055a41437679858e9fc9226e0.tar.gz
top: fixed wrong comment, made error message more clear
Diffstat (limited to 'procps')
-rw-r--r--procps/top.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/procps/top.c b/procps/top.c
index 1b6f707..7043d3e 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -76,7 +76,7 @@ static int mult_lvl_cmp(void* a, void* b) {
}
/* 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 @@ static void get_jiffy_counts(void)
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 @@ int top_main(int argc, char **argv)
#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);