Generic data, as CPU and memory usage, are used by Meters.
In paused mode they would stop receiving updates and especially Graph
Meters would stop showing continuous data.
Improves: #214Closes: #253
man:sysconf(3) states:
The values obtained from these functions are system configuration constants.
They do not change during the lifetime of a process.
The MIN, MAX, CLAMP, MINIMUM, and MAXIMUM macros appear
throughout the codebase with many re-definitions. Make
a single copy of each in a common header file, and use
the BSD variants of MINIMUM/MAXIMUM due to conflicts in
the system <sys/param.h> headers.
Reasoning:
- implementation was unsound -- broke down when I added a fairly
basic macro definition expanding to a struct initializer in a *.c
file.
- made it way too easy (e.g. via otherwise totally innocuous git
commands) to end up with timestamps such that it always ran
MakeHeader.py but never used its output, leading to overbuild noise
when running what should be a null 'make'.
- but mostly: it's just an awkward way of dealing with C code.
GCC10 and Clang11 now default to -fno-common.
ld: error: duplicate symbol: jail_errmsg
>>> defined at Platform.c
>>> freebsd/Platform.o:(jail_errmsg)
>>> defined at FreeBSDProcessList.c
>>> freebsd/FreeBSDProcessList.o:(.bss+0x90)
Signed-off-by: Tobias Kortkamp <t@tobik.me>
openzfs_sysctl_init() now returns void instead of int.
The ZfsArcStats->enabled flag is set inside the init function
now, instead of having to be set from its return value.
Preparation for more flag setting in Compressed ARC commit.
ZfsArcMeter_readStats() added and all Meter->values[] setting
moved to it, eliminating duplicated code in
{darwin,freebsd,linux,solaris}/Platform.c.
New meter displays same ARC stats as FreeBSD top(1).
Can be extended to other platforms that support ZFS.
Pulling kstat.zfs.misc.arcstats.c_max as the meter
total, so the meter has a meaningful value to work
up to.
The Text meter displays, first, the maximum
ARC size (Meter.total), then second, the total
ARC used, using the difference between Meter.maxItems
and Meter.curItems to "hide" the used value from the
Bar and Graph drawing functions by using an index
in Meter.values[] that is beyond curItems - 1, but
less than maxItems - 1.
Use the appropriate types when calling sysctl().
Currently, `unsigned long long int` is used for all sizes and on
FreeBSD/powerpc this causes all sysctl() calls in scanMemoryInfo()
to fail as they are actually of different sizes on powerpc, where
(sizeof(unsigned long long int), sizeof(u_long)) == (8, 4)
vs (8, 8) on amd64. This results in bogus memory sizes being
reported by htop.
Signed-off-by: Tobias Kortkamp <tobik@FreeBSD.org>
This involves switching from kvm_open(3) to kvm_openfiles(3). The only
difference is that the latter has saner error reporting (see the man
page for details). We can now fatally report the error rather than just
calling assert(3).
this caused htop to show processes as if freebsd kernel was their parent.
on next pass reparenting code took chance to run, and that caused process to jump around.
this fixed behaviour should be the correct one
PID1 or even any other PID (if there are custom reapers in the system).
Similar issue with jails, elevated process can ask kernel to attach itself into any jail at any time,
thus JID and jail name can change each refresh cycle.
Seems FreeBSD kernel can spawn both kernel processes (what is what htop currently sees) and kernel threads.
For now let's consider kernel processes kernel "threads".