Not all batteries entries in /sys/class/power_supply start with either
BAT or AC, but might have device specific names, e.g. CMB1.
Detect the types of those entries and parse them accordingly.
Closes: #881
Fixes: 3e70de64 ("Code clean up for reading battery info")
Show a non highlighted string at the start of htop, not the failure
text.
Also the original fix only handled the text mode, not the bar mode.
Improves: 2977414d ("Discard stale information from DiskIO and NetworkIO meters")
Related: #860
Use C99 struct initialization, which also makes using calloc redundant.
htop: Process.c:1179: int Process_compareByKey_Base(const Process *, const Process *, ProcessField): Assertion `0 && "Process_compareByKey_Base: default key reached"' failed.
If the new htop is configured with htoprc having no tabs (eg on upgrade)
then the interface will not automatically introduce/enable them.
However, for a fresh install of htop, enabling them automatically
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Commit d8dfbbd3 ("Tidy up process state handling") did change the
highlighting of the UNINTERRUPTIBLE_WAIT state (D) from red to gray.
As this state might means the process probably still has work to do and
can hint at bottlenecks, revert this particular change.
Fixes: d8dfbbd3 ("Tidy up process state handling")
Do not underflow count at the last iteration, which triggers UBSAN when
using -fsanitize=unsigned-integer-overflow. This is useful as those
underflows can be a result of a flawed counting logic (e.g. a counter
gets reduced more than increased).
When we close the application using the quit function F10, the last line
is cleared so that on terminals which do not support ALTBUF the last
line is not clobbered. This do not happen when the application exits as
a result of a signal (SIGINT,SIGTERM,SIGQUIT).
Move the logic to clear the last line into the CRT_done function. This
ensures that it will be executed when the CRT_handleSIGTERM is called.
Use PF_KTHREAD flag in /proc/[pid]/stat to detect kernel threads.
This fixed an issue when a process's cmdline is empty, htop think
it is a kernel thread.
This ensures the initial read of the data is not misinterpreted as arbitrarily large values.
Also this forces the maximum update interval between two subsequent reads to within 30s.
Fixes#860