Ampere boards use the APM X-Gene Hardware Monitoring driver. The label
the driver returns is "Soc Temperature" which the current code doesn't
detect. Fix that by adding a special case for it. This prevents it from
using the "CPU Power" sensor and reporting the CPU tempature as over
8000C (which is the power reported in mW).
Co-authored-by: Rebecca Cran <rebecca@os.amperecomputing.com>
This will spawn btop with a filter already set, which can be edited and
also deleted as usual.
Beware that the filter will ALWAYS also match btop itself, since the
--filter argument on the command line will match.
Closes: https://github.com/aristocratos/btop/issues/883
Easily replacable with `CMAKE_CXX_FLAGS=` at configure time.
Both options where for developers only, pedantic enabled too many
warnings together to be really useful. If there is desire to fix some
warnings they should be enabled one after another and added to the
default set of options.
When a user enters a special regex character that expects a closing
character, btop will crash before the user has a chance to enter the
closing character. This will now just be ignored and no process will
match the filter until the regex is valid again.
Closes: https://github.com/aristocratos/btop/issues/1133
src/linux/btop_collect.cpp:950:106: runtime error: division by zero
#0 0x61b286115a41 in Cpu::collect(bool) src/linux/btop_collect.cpp:950:106
#1 0x61b285e55cb7 in Runner::_runner(void*) src/btop.cpp:533:18
#2 0x61b285e085ca in asan_thread_start(void*) asan_interceptors.cpp.o
#3 0x7629b7719b7a in start_thread nptl/pthread_create.c:448:8
#4 0x7629b77977b7 in __GI___clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/linux/btop_collect.cpp:950:106
Reported-by clang:
src/linux/btop_collect.cpp:489:10: error: variable 'high' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
489 | if (high < 1) high = 80;
| ^~~~
src/linux/btop_collect.cpp:482:18: note: initialize the variable 'high' to silence this warning
482 | int64_t high, crit;
| ^
| = 0
src/linux/btop_collect.cpp:490:10: error: variable 'crit' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
490 | if (crit < 1) crit = 95;
| ^~~~
src/linux/btop_collect.cpp:482:24: note: initialize the variable 'crit' to silence this warning
482 | int64_t high, crit;
| ^
| = 0
src/linux/btop_collect.cpp:1648:29: error: variable 'totalMem' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
1648 | if (not meminfo.good() or totalMem == 0)
| ^~~~~~~~
src/linux/btop_collect.cpp:1642:19: note: initialize the variable 'totalMem' to silence this warning
1642 | int64_t totalMem;
| ^
| = 0
The variable free_priv is a constant bool; pass by value.
Reported by Address Sanitizer:
SUMMARY: AddressSanitizer: stack-use-after-return src/linux/btop_collect.cpp:1931:17 in Mem::collect(bool)::$_0::operator()() const
Reported by UBSAN:
src/linux/btop_collect.cpp:1933:57: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/linux/btop_collect.cpp:1933:57
src/linux/btop_collect.cpp:2038:93: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/linux/btop_collect.cpp:2038:93