2021-05-07 08:37:22 +02:00
|
|
|
--- ./top/top.c.orig 2021-02-09 10:11:25.000000000 +0000
|
|
|
|
+++ ./top/top.c 2021-05-07 05:35:17.936501694 +0000
|
|
|
|
@@ -2504,7 +2504,7 @@
|
2018-05-19 03:50:15 +02:00
|
|
|
(sorry Linux, but you'll have to close it for us) */
|
|
|
|
if (!fp) {
|
|
|
|
if (!(fp = fopen("/proc/stat", "r")))
|
|
|
|
- error_exit(fmtmk(N_fmt(FAIL_statopn_fmt), strerror(errno)));
|
|
|
|
+ return;
|
|
|
|
/* note: we allocate one more CPU_t via totSLOT than 'cpus' so that a
|
|
|
|
slot can hold tics representing the /proc/stat cpu summary */
|
|
|
|
Cpu_tics = alloc_c(totSLOT * sizeof(CPU_t));
|
2021-05-07 08:37:22 +02:00
|
|
|
@@ -4389,7 +4389,7 @@
|
2018-05-19 03:50:15 +02:00
|
|
|
tmptty.c_cc[VERASE] = *key_backspace;
|
|
|
|
#ifdef TERMIOS_ONLY
|
|
|
|
if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty))
|
|
|
|
- error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno)));
|
|
|
|
+ {}
|
|
|
|
tcgetattr(STDIN_FILENO, &Tty_tweaked);
|
|
|
|
#endif
|
|
|
|
// lastly, a nearly raw mode for unsolicited single keystrokes
|
2021-05-07 08:37:22 +02:00
|
|
|
@@ -4397,7 +4397,7 @@
|
2018-05-19 03:50:15 +02:00
|
|
|
tmptty.c_cc[VMIN] = 1;
|
|
|
|
tmptty.c_cc[VTIME] = 0;
|
|
|
|
if (-1 == tcsetattr(STDIN_FILENO, TCSAFLUSH, &tmptty))
|
|
|
|
- error_exit(fmtmk(N_fmt(FAIL_tty_set_fmt), strerror(errno)));
|
|
|
|
+ {}
|
|
|
|
tcgetattr(STDIN_FILENO, &Tty_raw);
|
|
|
|
|
|
|
|
#ifndef OFF_STDIOLBF
|
2021-05-07 08:37:22 +02:00
|
|
|
@@ -5969,7 +5969,7 @@
|
2018-05-19 03:50:15 +02:00
|
|
|
|
|
|
|
if (!Numa_node_tot) goto numa_nope;
|
|
|
|
|
|
|
|
- if (CHKw(w, View_CPUNOD)) {
|
|
|
|
+ if (Cpu_tics && CHKw(w, View_CPUNOD)) {
|
|
|
|
if (Numa_node_sel < 0) {
|
|
|
|
// display the 1st /proc/stat line, then the nodes (if room)
|
2021-05-07 08:37:22 +02:00
|
|
|
Msg_row += cpu_tics(&Cpu_tics[smp_num_cpus], N_txt(WORD_allcpus_txt), 1);
|
|
|
|
@@ -6004,10 +6004,10 @@
|
2018-05-19 03:50:15 +02:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
numa_nope:
|
|
|
|
- if (CHKw(w, View_CPUSUM)) {
|
|
|
|
+ if (Cpu_tics && CHKw(w, View_CPUSUM)) {
|
|
|
|
// display just the 1st /proc/stat line
|
2021-05-07 08:37:22 +02:00
|
|
|
Msg_row += cpu_tics(&Cpu_tics[smp_num_cpus], N_txt(WORD_allcpus_txt), 1);
|
2018-05-19 03:50:15 +02:00
|
|
|
- } else {
|
|
|
|
+ } else if (Cpu_tics) {
|
|
|
|
// display each cpu's states separately, screen height permitting...
|
2021-05-07 08:37:22 +02:00
|
|
|
if (w->rc.combine_cpus) {
|
|
|
|
for (i = 0; i < Cpu_faux_tot; i++) {
|