Commit Graph

62 Commits

Author SHA1 Message Date
Benny Baumann 4f1269cc9f Ensure buffer for environment is large enough on NetBSD 2022-05-06 14:35:50 +02:00
Benny Baumann edf319e53d Auto-size (normalized) CPU usage columns 2022-03-06 19:56:25 +01:00
Christian Göttsche 5bc988ad6d Use correct command field as default field
The default htop command process field has the enum identifier `COMM`
but the name `Command` (`COMM` is the field name for /proc/<PID>/comm).
2021-12-17 14:45:15 +01:00
Christian Göttsche 6e9a5e9e49 Mark ScreenDefaults const 2021-12-17 14:45:15 +01:00
Christian Göttsche 14f428a172 Drop unused Platform variables 2021-12-17 14:45:15 +01:00
Hisham Muhammad 72ba20fa5f Introduce screen tabs
This is a forward port (by nathans) of Hisham's original code.
2021-12-07 17:04:49 +11:00
Nathan Scott e7a8d14cbd Correct the order of xCalloc parameters in a couple of places
No functional change.  Thanks to @BenBE for pointing these out.
2021-11-05 09:22:09 +11:00
marcluque d8dfbbd37c Tidy up process state handling 2021-11-02 20:02:54 +01:00
Volodymyr Vasiutyk 2ef70ad7f6 Early program termination only from main() 2021-10-31 15:07:00 +01:00
Silke Hofstra 696f79fe50 Dynamically scale the ST_UID size to support 32-bit UIDs
While most Unix-like systems use 16-bit user IDs,
Linux supports 32-bit UIDs since version 2.6.
UIDs above 65535 are used for UID namespacing of containers,
where a container has its own set of 16-bit user IDs.
Processes in such containers will have (much) larger UIDs than 65535.

Because the current format strings for `ST_UID` and `USER`
are `%5d` and `%9d` respectively, processes with such UIDs
lead to misaligned columns.

Dynamically scale the `ST_UID` column and increase the size of `USER`
to 10 characters (length of UINT32_MAX) to ensure that the user ID always fits.

Additionally: clean up how the titlebuffer size calculation and ensure
the PID column has a minimum size of 5.
2021-10-27 21:20:59 +02:00
Benny Baumann d520199e62 Memory leak on NetBSD when querying full command line 2021-10-03 19:18:25 +02:00
Daniel Lange 94ad111391 Update license headers to explicitly say GPLv2+ 2021-09-22 14:28:19 +02:00
Christian Göttsche 2844429f15 NetBSD: scale CPU frequencies
Use a value type of 'long int' to avoid ENOMEM failures of sysctl(3).

Also check for "machdep.tsc_freq", scaled in MHz.
2021-09-03 12:17:45 +02:00
Christian Göttsche 3834f2a68f NetBSD: misc const additions 2021-09-03 12:17:45 +02:00
Christian Göttsche 343c2e58be NetBSD: update process fields
Populate fields to ttyname, minflt, majflt and processor.
2021-09-03 12:17:45 +02:00
Christian Göttsche fd2c4f5ddd NetBSD: fix reading environment variables of processes
kvm_getenvv(3) seems not to work with kvm_openfiles(..., KVM_NO_FILES,
...)
2021-09-03 12:17:45 +02:00
Christian Göttsche 7f95ed8528 NetBSD: simplify Platform_setMemoryValues 2021-09-03 12:17:45 +02:00
Nathan Scott c0c2bb98a2 Add completion handling for dynamic meters and columns
Be sure to free dynamic memory allocated for meters and
columns strings, no-op on platforms other than pcp.

Closes #774
2021-09-03 09:47:01 +02:00
Christian Göttsche b965417bf7 Add combined memory and swap meter
Closes: #699
2021-08-17 10:36:10 +02:00
Benny Baumann b42c441ee0 Use proper metric to detect kernel threads
Querying kernel threads with `ps -o pid,lid,flags,state,lname -sp 0`
gives that kernel threads have state `K` and flags have mask `0x20000` set.
This corresponds to `LW_SYSTEM` in kernel which is mapped as `L_SYSTEM`/`P_SYSTEM` for userspace.
2021-08-16 08:03:57 +02:00
fraggerfox 68123adb6f Build fix for NetBSD 2021-08-16 07:45:04 +02:00
nia dd91e9a9da netbsd: Add NetworkIOMeter support 2021-08-13 22:27:14 +02:00
Nathan Scott f839095e3b Merge branch 'dynamic-columns' of https://github.com/smalinux/htop into smalinux-dynamic-columns 2021-08-13 15:56:01 +10:00
Sohaib Mohamed 6f2021f3d9 PCP: support for 'dynamic columns' added at runtime
Implements support for arbitrary Performance Co-Pilot
metrics with per-process instance domains to form new
htop columns.  The column-to-metric mappings are setup
using configuration files which will be documented via
man pages as part of a follow-up commit.

We provide an initial set of column configurations so
as to provide new capabilities to pcp-htop: including
configs for containers, open fd counts, scheduler run
queue time, tcp/udp bytes/calls sent/recv, delay acct,
virtual machine guests, detailed virtual memory, swap.

Note there is a change to the configuration file path
resolution algorithm introduced for 'dynamic meters'.
First, look in any custom PCP_HTOP_DIR location.  Then
iterate, in priority order, users home directory, then
local sysadmins files in /etc/pcp/htop, then readonly
configuration files below /usr/share/pcp/htop.  This
final location becomes the preferred place for our own
shipped meter and column files.

The Settings file (htoprc) writing code is updated to
not using the numeric identifier for dynamic columns.
The same strategy used for dynamic meters is used here
where we write Dynamic(name) so the name can be setup
once more at start.  Regular (static) columns writing
to htoprc - i.e. numerically indexed - is unchanged.
2021-08-13 07:32:57 +02:00
nia 6d3b4a0f2e netbsd: handle repeated ENOMEM from HW_IOSTATS safely 2021-08-09 14:17:06 +02:00
nia 324f9d048d netbsd: add more robust error handling for sysctl HW_IOSTATS 2021-08-09 09:08:37 +02:00
nia 5b8654d341 netbsd: Add support for DiskIOMeter 2021-08-09 09:08:37 +02:00
nia 97a859c5bd netbsd: Use newer proplib API. Create aliases so it works on 9.x.
This way we avoid deprecation warnings on the development branch
of NetBSD while keeping the code functioning on the stable branch.
2021-08-05 10:47:14 +02:00
nia c85aafa608 netbsd: If at least one AC adapter is connected, keep its state. 2021-08-05 10:47:14 +02:00
nia 93ca5af953 netbsd: style: declare variables on first use rather than C89-style 2021-08-05 10:47:14 +02:00
nia fdcdc54ec4 netbsd: Add battery support
This uses proplib and sysmon_envsys to determine the total charge
percentage of any number of connected batteries as well as the
AC adapter state. Should work with ACPI and non-ACPI systems.
2021-08-05 10:47:14 +02:00
fraggerfox 2e3f34f5c1 NetBSD: Rework CPU counting. 2021-08-05 10:25:59 +02:00
nia 4f3ba680fb Fix indentation style 2021-07-21 21:06:58 +02:00
nia 3fced48eea netbsd: convert snprintf use to xSnprintf 2021-07-21 21:06:58 +02:00
nia a4b650fdec netbsd: re-initialize freqSize before sysctlbyname() 2021-07-21 21:06:58 +02:00
nia 72cea2881c netbsd: Remove conditional compilation of CPU frequency variables 2021-07-21 21:06:58 +02:00
nia b4884373e5 netbsd: Support display of CPU frequency 2021-07-21 21:06:58 +02:00
Benny Baumann 0d85af2872 Whitespace around operators 2021-07-15 06:57:24 +02:00
Benny Baumann 458749df45 Code indentation 2021-07-15 06:57:24 +02:00
Benny Baumann e7f8d7bcc9 Split statements that should go onto multiple lines 2021-07-15 06:57:24 +02:00
nia 3bc73aa088
netbsd: update README.md (#694)
netbsd: update README.md
2021-07-15 06:41:42 +02:00
nia 4865e643ad netbsd: Fix display of in-use and cached memory 2021-07-13 19:06:30 +02:00
nia 67ca214cbe netbsd: Add dyanmicMeters stubs to fix the build
Signed-off-by: Nia Alarie <nia@NetBSD.org>
2021-07-13 19:05:24 +02:00
BenBE 3bed682b1e Always update `proc->st_uid` + `proc->user`
Avoids issue #661.
2021-06-26 12:18:37 +02:00
fraggerfox 686309e34c Redo the memory values based on the other BSD implementations. 2021-06-26 12:18:37 +02:00
fraggerfox 5fe9bcb21c Adds support for counting user and kernel threads. 2021-06-26 12:18:37 +02:00
fraggerfox 336acb0309 Adds support for PROC_EXE and CWD. 2021-06-26 12:18:37 +02:00
fraggerfox 612462e33d Adds the ELAPSED column for NetBSD.
Additional details regarding ELAPSED column can be found in #627.
2021-06-26 12:18:37 +02:00
fraggerfox 58a895e54c Fixes minor whitespace issues and re-arrange headers to conform to style guide. 2021-06-26 12:18:37 +02:00
fraggerfox 9de463e756 Implements the NetBSD specific changes for makeCommandStr refactor.
Refer to #388 PR for more details.
2021-06-26 12:18:37 +02:00