Follow up on the two items of feedback from cgzones review,
and resolve a build failure picked up by CI on Mac OS X.
Related to https://github.com/htop-dev/htop/pull/564
The libcap code is Linux-specific so move it all below
the linux/ platform subdirectory. As this feature has
custom command-line long options I provide a mechanism
whereby each platform can add custom long options that
augment the main htop options. We'll make use this of
this with the pcp/ platform in due course to implement
the --host and --archive options there.
Related to https://github.com/htop-dev/htop/pull/536
This prefers the `#if defined()` syntax over the `#ifdef` variant
whenever there's also a `#elif defined()` clause, thus making the
multiple branching structure more obvious and the overall use
more consistent.
* Set process data for:
- minflt
- majflt
- processor
- nlwp
* Drop unimplemented nlwp column
* Scan userland threads
* Mark a 'Thread is currently on a CPU.' with 'R', and processes
'Currently runnable' with 'P', do confine with man:ps(1) and Linux.
See https://man.openbsd.org/ps.1
* Show CPU frequency
Currently the tree-view is empty on OpenBSD when kernel threads are
hidden, cause the kernel thread 'swapper' has pid 0 and gets treated as
root of the tree and parent of 'init'.
Do not build any tree with a pid 0 root node.
Do not read driver depended labels, just count the number of
temperatures given:
on #CPU:
platform temp = max cpu temp
CPU temps = first to last
on #CPU + 1:
platform temp = first temp
CPU temps = second to last
on #CPU / 2:
platform temp = max cpu temp
CPU temps = first to last concat first to last
(with SMT core x + cpu count is the logical core of the physical
core x)
on #CPU / 2 + 1:
platform temp = first temp
CPU temps = second to last concat second to last
(with SMT core x + cpu count is the logical core of the physical
core x)
Closes: #529Closes: #538
The hwloc header generates lots of warnings:
In file included from Action.c:10:
In file included from ./Action.h:15:
In file included from ./Header.h:10:
In file included from ./Meter.h:18:
In file included from ./ProcessList.h:25:
In file included from /usr/include/hwloc.h:2371:
/usr/include/hwloc/helper.h:481:5: warning: Value stored to 'state' is never read [deadcode.DeadStores]
state = 3;
^ ~
1 warning generated.
The local stack buffer does not need to be cleaned to zeros when
- just initialized, cause the length is set to 0 and the first
character is set to '\0', so all printing functions will safely stop
- no further used, i.e. the variable goes out of scope
- stay in follow mode on sort inversion (I)
- stay in follow mode after viewing help screen (h)
- select parent process (where available) when having followed a thread
and hiding these (H)
Closes: #560
Combine reading CPU count and CPU usage, only open the file once.
Do not separately initialize totalPeriod and totalTime, cause the value
0 is handled in Platform_setCPUValues().
Take the number of currently running process from the entry
procs_running in /proc/stat instead of counting all scanned process
with state 'R', to include hidden tasks, e.g. threads.
Writing to the file stream might fail due to a immutable file or a
filesystem error.
Check the error indicator for the stream and for fclose() failures.
Code that is shared across some (but not all) platforms
is moved into a 'generic' home. Makefile.am cleanups to
match plus some minor alphabetic reordering/formatting.
As discussed in https://github.com/htop-dev/htop/pull/553