diff options
-rw-r--r-- | procps/top.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/procps/top.c b/procps/top.c index 1b6f7072f..7043d3e6a 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -76,7 +76,7 @@ static int mult_lvl_cmp(void* a, void* b) { | |||
76 | } | 76 | } |
77 | 77 | ||
78 | /* This structure stores some critical information from one frame to | 78 | /* This structure stores some critical information from one frame to |
79 | the next. mostly used for sorting. Added cumulative and resident fields. */ | 79 | the next. Mostly used for sorting. */ |
80 | struct save_hist { | 80 | struct save_hist { |
81 | int ticks; | 81 | int ticks; |
82 | int pid; | 82 | int pid; |
@@ -108,7 +108,7 @@ static void get_jiffy_counts(void) | |||
108 | if (fscanf(fp, "cpu %lld %lld %lld %lld %lld %lld %lld %lld", | 108 | if (fscanf(fp, "cpu %lld %lld %lld %lld %lld %lld %lld %lld", |
109 | &jif.usr,&jif.nic,&jif.sys,&jif.idle, | 109 | &jif.usr,&jif.nic,&jif.sys,&jif.idle, |
110 | &jif.iowait,&jif.irq,&jif.softirq,&jif.steal) < 4) { | 110 | &jif.iowait,&jif.irq,&jif.softirq,&jif.steal) < 4) { |
111 | bb_error_msg_and_die("failed to read 'stat'"); | 111 | bb_error_msg_and_die("failed to read /proc/stat"); |
112 | } | 112 | } |
113 | fclose(fp); | 113 | fclose(fp); |
114 | jif.total = jif.usr + jif.nic + jif.sys + jif.idle | 114 | jif.total = jif.usr + jif.nic + jif.sys + jif.idle |
@@ -392,22 +392,18 @@ int top_main(int argc, char **argv) | |||
392 | #endif /* CONFIG_FEATURE_USE_TERMIOS */ | 392 | #endif /* CONFIG_FEATURE_USE_TERMIOS */ |
393 | 393 | ||
394 | /* do normal option parsing */ | 394 | /* do normal option parsing */ |
395 | interval = 5; | ||
395 | opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval); | 396 | opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval); |
396 | if ((opt & 1)) { | 397 | if (opt & 1) |
397 | interval = atoi(sinterval); | 398 | interval = atoi(sinterval); |
398 | } else { | ||
399 | /* Default update rate is 5 seconds */ | ||
400 | interval = 5; | ||
401 | } | ||
402 | 399 | ||
403 | /* change to /proc */ | 400 | /* change to /proc */ |
404 | xchdir("/proc"); | 401 | xchdir("/proc"); |
405 | #ifdef CONFIG_FEATURE_USE_TERMIOS | 402 | #ifdef CONFIG_FEATURE_USE_TERMIOS |
406 | tcgetattr(0, (void *) &initial_settings); | 403 | tcgetattr(0, (void *) &initial_settings); |
407 | memcpy(&new_settings, &initial_settings, sizeof(struct termios)); | 404 | memcpy(&new_settings, &initial_settings, sizeof(struct termios)); |
408 | new_settings.c_lflag &= ~(ISIG | ICANON); /* unbuffered input */ | 405 | /* unbuffered input, turn off echo */ |
409 | /* Turn off echoing */ | 406 | new_settings.c_lflag &= ~(ISIG | ICANON | ECHO | ECHONL); |
410 | new_settings.c_lflag &= ~(ECHO | ECHONL); | ||
411 | 407 | ||
412 | signal(SIGTERM, sig_catcher); | 408 | signal(SIGTERM, sig_catcher); |
413 | signal(SIGINT, sig_catcher); | 409 | signal(SIGINT, sig_catcher); |