mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 15:54:56 +00:00
top: fixed wrong comment, made error message more clear
This commit is contained in:
parent
0c45bb23d2
commit
42dfcd2612
16
procps/top.c
16
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
|
/* 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 {
|
struct save_hist {
|
||||||
int ticks;
|
int ticks;
|
||||||
int pid;
|
int pid;
|
||||||
@ -108,7 +108,7 @@ static void get_jiffy_counts(void)
|
|||||||
if (fscanf(fp, "cpu %lld %lld %lld %lld %lld %lld %lld %lld",
|
if (fscanf(fp, "cpu %lld %lld %lld %lld %lld %lld %lld %lld",
|
||||||
&jif.usr,&jif.nic,&jif.sys,&jif.idle,
|
&jif.usr,&jif.nic,&jif.sys,&jif.idle,
|
||||||
&jif.iowait,&jif.irq,&jif.softirq,&jif.steal) < 4) {
|
&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);
|
fclose(fp);
|
||||||
jif.total = jif.usr + jif.nic + jif.sys + jif.idle
|
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 */
|
#endif /* CONFIG_FEATURE_USE_TERMIOS */
|
||||||
|
|
||||||
/* do normal option parsing */
|
/* do normal option parsing */
|
||||||
|
interval = 5;
|
||||||
opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval);
|
opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval);
|
||||||
if ((opt & 1)) {
|
if (opt & 1)
|
||||||
interval = atoi(sinterval);
|
interval = atoi(sinterval);
|
||||||
} else {
|
|
||||||
/* Default update rate is 5 seconds */
|
|
||||||
interval = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* change to /proc */
|
/* change to /proc */
|
||||||
xchdir("/proc");
|
xchdir("/proc");
|
||||||
#ifdef CONFIG_FEATURE_USE_TERMIOS
|
#ifdef CONFIG_FEATURE_USE_TERMIOS
|
||||||
tcgetattr(0, (void *) &initial_settings);
|
tcgetattr(0, (void *) &initial_settings);
|
||||||
memcpy(&new_settings, &initial_settings, sizeof(struct termios));
|
memcpy(&new_settings, &initial_settings, sizeof(struct termios));
|
||||||
new_settings.c_lflag &= ~(ISIG | ICANON); /* unbuffered input */
|
/* unbuffered input, turn off echo */
|
||||||
/* Turn off echoing */
|
new_settings.c_lflag &= ~(ISIG | ICANON | ECHO | ECHONL);
|
||||||
new_settings.c_lflag &= ~(ECHO | ECHONL);
|
|
||||||
|
|
||||||
signal(SIGTERM, sig_catcher);
|
signal(SIGTERM, sig_catcher);
|
||||||
signal(SIGINT, sig_catcher);
|
signal(SIGINT, sig_catcher);
|
||||||
|
Loading…
Reference in New Issue
Block a user