Commit Graph

529 Commits

Author SHA1 Message Date
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
Christian Göttsche 6974ce8e79 Linux: do not include zram devices in DiskIO
The meter is intended to show *real* IO, which is significantly slower
than zram.
2021-08-10 22:01:42 +02:00
Nathan Scott 02cfd38671 The average CPU utilization value must never be marked 'offline'
Fixes https://github.com/htop-dev/htop/issues/729
2021-08-10 08:00:35 +02:00
Daniel Lange eb4ff3c69c Add Shift-F7, Shift-F8 keybindings for autogroups 2021-08-09 16:23:09 +10:00
Nathan Scott 1bd95983b2 Add columns for process autogroup identifier and nice value
Adds AGRP (autogroup) and ANI (autogroup nice) columns that
report the information from /proc/PID/autogroup, as well as
handlers for '{' and '}' to change the autogroup nice value.

This is guarded by /proc/sys/kernel/sched_autogroup_enabled
such that sampling and/or changing values wont be attempted
unless the kernel feature is enabled.

Fixes: #720
2021-08-09 07:56:13 +02:00
Christian Göttsche 10e9ffd8e5 Fix misc typos
[ci skip]
2021-08-08 15:10:58 +02:00
Christian Göttsche 11d2206f40 Add ProcessList_isCPUonline 2021-07-18 07:47:09 +02:00
Christian Göttsche 41af31be7f Rework CPU counting
Currently htop does not support offline CPUs and hot-swapping, e.g. via
    echo 0 > /sys/devices/system/cpu/cpu2/online

Split the current single cpuCount variable into activeCPUs and
existingCPUs.

Supersedes: #650
Related: #580
2021-07-18 07:44:02 +02:00
Scott Olson d45b4f4a43 Use PATH lookup for systemctl in systemd meter
Before this change, the systemd meter was broken on distros like NixOS,
which have systemctl in PATH, but not at /bin/systemctl. After the
change, it works on all my NixOS machines.
2021-07-15 10:21:12 +02:00
Benny Baumann df435931b6 Proper label indentation 2021-07-15 06:57:24 +02:00
Benny Baumann 976c6123f4 Pointer indication aligned to typename 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
Nathan Scott f0ed0fdafb Add a new DynamicMeter class for runtime Meter extension
This commit is based on exploratory work by Sohaib Mohamed.
The end goal is two-fold - to support addition of Meters we
build via configuration files for both the PCP platform and
for scripts ( https://github.com/htop-dev/htop/issues/526 )

Here, we focus on generic code and the PCP support.  A new
class DynamicMeter is introduced - it uses the special case
'param' field handling that previously was used only by the
CPUMeter, such that every runtime-configured Meter is given
a unique identifier.  Unlike with the CPUMeter this is used
internally only.  When reading/writing to htoprc instead of
CPU(N) - where N is an integer param (CPU number) - we use
the string name for each meter.  For example, if we have a
configuration for a DynamicMeter for some Redis metrics, we
might read and write "Dynamic(redis)".  This identifier is
subsequently matched (back) up to the configuration file so
we're able to re-create arbitrary user configurations.

The PCP platform configuration file format is fairly simple.
We expand configs from several directories, including the
users homedir alongside htoprc (below htop/meters/) and also
/etc/pcp/htop/meters.  The format will be described via a
new pcp-htop(5) man page, but its basically ini-style and
each Meter has one or more metric expressions associated, as
well as specifications for labels, color and so on via a dot
separated notation for individual metrics within the Meter.

A few initial sample configuration files are provided below
./pcp/meters that give the general idea.  The PCP "derived"
metric specification - see pmRegisterDerived(3) - is used
as the syntax for specifying metrics in PCP DynamicMeters.
2021-07-07 10:59:36 +10:00
fraggerfox 3770769ed1 Replaces WRAP_SUBTRACT with saturatingSub inline function to reduce code duplication. 2021-06-26 12:18:37 +02:00
Christian Göttsche df752dd189 Do not override Linux process library size
The library size in statm is unused and always 0 since Linux 2.6.

Fixes: 8154125d4b
2021-06-12 20:44:33 +02:00
Christian Göttsche 45ab05c56a Limit deleted library check
Reading and parsing /proc/<pid>/maps is quite expensive.

Do not check for deleted libraries if the main binary has been deleted;
in this case the deleted binary takes precedence.

Do not check in threads.  The check is void for kernel threads and user-
land threads can just inherit the state from the main process structure.
2021-06-12 16:02:23 +02:00
Christian Göttsche 9114cf6ea3 Linux: update process uid on change
Always check if the user of a process changed, e.g. by using setuid(2).
2021-06-09 22:52:18 +02:00
Christian Göttsche faabbaa71e Linux: drop O_PATH usage
O_PATH is available since Linux 2.6.39, but we are using fstat(2) on the
returned file descriptor in LinuxProcessList_statProcessDir(), which
is only supported since Linux 3.6.

Fixes #534
2021-06-09 22:52:18 +02:00
Christian Göttsche 8154125d4b Check processes for using deleted shared libraries
Shared libraries can be replaced by an upgrade, highlight processes
using deleted shared libraries.

Link with highlightDeletedExe setting, enabled by default.

Currently only checked on Linux.
2021-06-09 14:40:04 +02:00
Benny Baumann b6ff5c8a2e Move CWD field handling to platform-neutral code 2021-05-25 21:55:04 +02:00
Christian Göttsche c408add108 Linux: add reset to heuristic
On hard to parse command lines tokenStart might be computed to be bigger
than tokenEnd.
Reset both values in such cases.
2021-05-25 18:20:09 +02:00
Christian Göttsche 550a141860 Add ELAPSED process column
Add process columns showing the elapsed time since the process was
started.
Similar to STARTTIME, but shows the time passed since the process start
instead of the fixed start time of the process.

Closes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782636
2021-05-23 15:43:23 +02:00
Christian Göttsche 3d5b6d9282 Fix assert failure on short running thread
The following assert failure might happen on short running threads with
an empty comm value in /proc/${pid}/stat:

htop: Process.c:1159: void Process_updateCmdline(Process *, const char *, int, int): Assertion `(cmdline && basenameStart < (int)strlen(cmdline)) || (!cmdline && basenameStart == 0)' failed.

The specific task is:
    comm=''
    exe='(null)'
    cmdline='/usr/bin/ruby /usr/bin/how-can-i-help --apt'

So basenameStart is 0, while strlen(cmdline) is also 0.
2021-05-23 15:25:23 +02:00
Benny Baumann 51ecc62d92 Force update when executable was recently deleted/replaced 2021-05-23 09:30:36 +02:00
Christian Göttsche 7892ac68fb Linux: use merge command line helpers 2021-05-23 09:22:21 +02:00
Christian Göttsche 7c654559c9 Linux: drop obsolete code now in Process_writeField 2021-05-23 09:22:21 +02:00
Benny Baumann 7ef58f2dcf Drop mc->maxLen field 2021-05-23 09:22:21 +02:00
Benny Baumann aa8552ba88 Move PROC_COMM/PROC_EXE column handling to global Process implementation 2021-05-23 09:22:21 +02:00
Benny Baumann a61a2e6d47 Call makeCommandStr on all platforms 2021-05-23 09:22:21 +02:00
Benny Baumann bcb18ef822 Move Process_makeCommandStr to global Process implementation 2021-05-23 09:22:21 +02:00
Benny Baumann c0d0202440 Move LinuxProcess_getCommandStr to Process_getCommandStr 2021-05-23 09:22:21 +02:00
Benny Baumann 7224d0e083 Move kernel/userland thread handling to platform-independent implementation 2021-05-23 09:22:21 +02:00
Benny Baumann 1a1fddae85 Pre-calculate isUserlandThread flag 2021-05-23 09:22:21 +02:00
Benny Baumann cdb660adab Move mergeCommand to global process struct 2021-05-23 09:22:21 +02:00
Benny Baumann 94a52cb5c9 Rename cmdlineBasenameOffset to cmdlineBasenameEnd to properly indicate the fields purpose 2021-05-23 09:22:21 +02:00
Benny Baumann 666f70c58c Move procCmdlineBasenameOffset as cmdlineBasenameStart to global Process structure 2021-05-23 09:22:21 +02:00
Benny Baumann 6dc485dd20 Remove duplicate field LinuxProcess->procCmdlineBasenameEnd
This field held practically the same value as cmdlineBasenameEnd
2021-05-23 09:22:21 +02:00
Benny Baumann a685661866 Move procExeBasenameOffset to main Process structure
This drops procExeLen, as that field is implicit by strlen(Process->procExe)
2021-05-23 09:22:21 +02:00
Benny Baumann 93a44acf7e Move procExeDeleted flag to main Process structure 2021-05-23 09:22:21 +02:00
Benny Baumann b839987df7 Rename basenameOffset to cmdlineBasenameOffset 2021-05-23 09:22:21 +02:00
Benny Baumann d74e8b7554 Move procComm and procExe to main Process structure 2021-05-23 09:22:21 +02:00
Benny Baumann 02431c43e1 Rename command line field from comm to cmdline 2021-05-23 09:22:21 +02:00
Benny Baumann fbec3e4005 Refactor makeCommandStr 2021-05-23 09:22:21 +02:00
mayurdahibhate 3f86a011e6 platform-dependent files included relative to main source directory 2021-05-10 18:40:53 +02:00
mayurdahibhate 1b74dfe187 cleaned up includes with iwyu 2021-05-10 18:40:53 +02:00
Christian Göttsche 323d7e73aa Linux: update IO fields
- fix header width of IO_READ_RATE

- save data in bytes (not kilobytes) to better compute rate

- fix rate data: multiply with 1000 to compensate time difference in
  milliseconds

- rename unit less variable now into realtimeMs

- use Process_printBytes(..., data * pageSize, ...) instead of
  Process_printKBytes(..., data * pageSizeKB, ...) to avoid wrapper
2021-04-26 18:02:58 +02:00
Christian Göttsche b41e4d9c54 Rework process field print functions
Make functions formatting data for a process field column less error
prone, unify interfaces and improve some internals.

* Process_printBytes
  - rename from Process_humanNumber
  - take number in bytes, not kilobytes
  - handle petabytes
  - increase buffer to avoid crashes when the passed value is
    ~ ULLONG_MAX

* Process_printKBytes
  - add wrapper for Process_printBytes taking kilobytes keeping -1 as
  special value

* Process_printCount
  - rename from Process_colorNumber

* Process_printTime
  - add coloring parameter as other print functions
  - improve coloring and formatting for larger times

* Process_printRate
  - rename from Process_outputRate
  - use local buffer instead of passed one; this function prints to the
    RichString after all
2021-04-26 18:02:58 +02:00
Christian Göttsche 6bbb454881 LinuxProcess: print default buffer in ascii
`RichString_appendWide()` is more expensive than
`RichString_appendAscii()` due to the calls to `mbstowcs(3)` and
`iswprint(3)`.

Use the latter to print the process field buffer by default.

For the following fields this theoretically can corrupt the output:
  - SECATTR
  - CGROUP
  - CTID
2021-04-26 17:51:45 +02:00
Christian Göttsche 436808ff99 Use RichString_appendnAscii where possible
`RichString_appendnAscii()` avoids a `strlen(3)` call over
` RichString_appendAscii()`.
Use the former where the length is available from a previous checked
`snprintf(3)` call.

Keep `RichString_appendAscii()` when passing a string literal and
rely on compilers to optimize the `strlen(3)` call away.
2021-04-26 17:51:45 +02:00
Christian Göttsche 2d7069feb4 Linux: handle Shmem being part of Cached
See https://lore.kernel.org/patchwork/patch/648763/

Do not show twice by subtracting from Cached.

Closes: #591
2021-04-22 10:48:15 +02:00
Christian Göttsche a05e78f531 Linux: use more robust pid parsing
Also add comment to condition
2021-04-21 20:58:28 +02:00
Christian Göttsche 9a8221568a Rework TTY column
* Rename internal identifier from TTY_NR to just TTY
* Unify column header on platforms
* Use devname(3) on BSD derivate to show the actual terminal,
  simplifies current FreeBSD implementation.
* Use 'unsigned long int' as id type, to fit dev_t on Linux.

Only on Solaris the terminal path is not yet resolved.
2021-04-14 17:29:56 +02:00
Christian Göttsche 36880cd61c Add read-only option
Add command line option to disable all system and process changing
features.
2021-04-14 17:21:43 +02:00
Christian Göttsche 812cfcb94d Rename drop-capabilities options none to off
None might be ambiguous whether we are dropping none or whether we keep
none.

Rename to off to make more clear this option does not drop any.
2021-04-14 17:19:26 +02:00
Christian Göttsche 74d061700c LinuxProcessList_recurseProcTree(): drop non necessary parameter 2021-04-14 17:16:02 +02:00
Nathan Scott 356488aa53 Request the realtime and monotonic clock times once per sample
Refactor the sample time code to make one call to gettimeofday
(aka the realtime clock in clock_gettime, when available) and
one to the monotonic clock.  Stores each in more appropriately
named ProcessList fields for ready access when needed.  Every
platform gets the opportunity to provide their own clock code,
and the existing Mac OS X specific code is moved below darwin
instead of in Compat.

A couple of leftover time(2) calls are converted to use these
ProcessList fields as well, instead of yet again sampling the
system clock.

Related to https://github.com/htop-dev/htop/pull/574
2021-04-05 23:41:07 +02:00
Sohaib 421bdeec60 Merging all the points related to calculating time in one place
The end goal is to consolidate all the points in htop that can only work in
live-only mode today, so that will be able to inject PCP archive mode and have
a chance at it working.
The biggest problem we've got at this moment is all the places that are
independently asking the kernel to 'give me the time right now'.
Each of those needs to be audited and ultimately changed to allow platforms to
manage their own idea of time.
So, all the calls to gettimeofday(2) and time(2) are potential problems.
Ultimately I want to get these down to just one or two.

Related to https://github.com/htop-dev/htop/pull/574
2021-04-05 23:40:41 +02:00
Christian Göttsche 73f5ecf528 Linux: handle garbage in /proc/loadavg
When parsing the content of /proc/loadavg via fscanf(3), ensure client
passed parameters are set to sanitized values.

Related to: #581
2021-03-28 19:20:28 +02:00
Christian Göttsche 5ef3c26168 Drop always true condition
The variable 'dir' is checked in line 645:
    if (!dir)
        return AC_ERROR;
2021-03-24 19:36:34 +01:00
Christian Göttsche a19b176099 Correct spelling in comment 2021-03-24 19:27:57 +01:00
Christian Göttsche 9c437ceb0c Drop unused attributes of actually used function parameters
These parameters were once unused, but not anymore.
2021-03-24 19:27:03 +01:00
Christian Göttsche 7b293dc3e2 Linux: fix --drop-capabilities
Do not return false (= argument not handled) when actually handled
2021-03-22 11:56:19 +01:00
Nathan Scott 253ff23f9e Use a platform-specific routine for long option usage
Related to https://github.com/htop-dev/htop/pull/564
2021-03-22 17:16:40 +11:00
Nathan Scott 0ada9f325f Move libcap use to (Linux) platform-specific code
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
2021-03-22 17:16:40 +11:00
Benny Baumann 57e0ce7b4f Use `#if defined()` syntax when `#elif defined()` is present
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.
2021-03-21 21:49:04 +01:00
Daniel Lange 1cb3aee07a Merge branch 'cputemp' of cgzones/htop 2021-03-21 18:09:14 +01:00
Christian Göttsche a11d01568c Use unsigned types for CPU counts and associated variables 2021-03-19 23:30:54 +01:00
Christian Göttsche f46fcf094e Linux: Rework libsensors parsing
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: #529
Closes: #538
2021-03-19 22:11:22 +01:00
Daniel Lange 67b815a817 Merge branch 'shared_before_cached' of cgzones/htop 2021-03-19 09:49:36 +01:00
Christian Göttsche e942736267 LinuxProcessList: drop unnecessary parenthesis 2021-03-17 17:53:00 +01:00
Christian Göttsche 9f41dc3332 MemoryMeter: show shared memory before cached
Shared memory is less free-able than cached memory.

Show it beforehand.
2021-03-17 16:32:16 +01:00
Christian Göttsche d9f2eacbc5 Linux: individually show shared memory
Shmem: Total memory used by shared memory (shmem) and tmpfs

Source: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

Closes: #556
2021-03-15 22:34:14 +01:00
Christian Göttsche 0cfc9b0980 LinuxProcessList: refactor /proc/stat parsing
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.
2021-03-12 17:31:45 +01:00
Nathan Scott 31e59cc60d Merge branch 'misc' of https://github.com/cgzones/htop into cgzones-misc 2021-03-05 13:38:19 +11:00
Christian Göttsche 2d1042adb3 Save text buffer in Meter 2021-03-04 23:57:45 +01:00
Nathan Scott adaf748ab6 Fix include file ordering of generic headers 2021-03-04 13:44:40 +11:00
Nathan Scott 61ef1134d9 Move generic (shared) code into its own sub-directory
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
2021-03-04 13:40:59 +11:00
Nathan Scott 5b50ae3aa3 Separate display from sampling in SysArch and Hostname Meters
Several of our newer meters have merged coding concerns in terms
of extracting values and displaying those values.  This commit
rectifies that for the SysArch and Hostname meters, allowing use
of this code with alternative front/back ends.  The SysArch code
is also refined to detect whether the platform has an os-release
file at all and/or the sys/utsname.h header via configure.ac.
2021-03-04 13:40:11 +11:00
Christian Göttsche ff4ee2eafc LinuxProcess: Drop dead assignment
Modern compilers are very good at finding uninitialized paths, lets rely
on them.
2021-03-02 22:37:47 +01:00
Christian Göttsche 13b28fa9ed Enclose macro argument in parentheses 2021-03-02 22:03:20 +01:00
Nathan Scott 29570c0133
Merge pull request #550 from natoscott/diskio-types
Fix integer sizing issues in the DiskIO Meter
2021-03-02 13:34:52 +11:00
Nathan Scott 00339087b0 Fix integer sizing issues in the DiskIO Meter
On Linux kernels the size of the values exported for block
device bytes has used a 64 bit integer for quite some time
(2.6+ IIRC).  Make the procfs value extraction use correct
types and change internal types used to rate convert these
counters (within the DiskIO Meter) 64 bit integers, where
appropriate.
2021-03-01 12:10:18 +11:00
Nathan Scott 2d1839289e Fix integer sizing issues in the NetworkIO Meter
On Linux kernels the size of the values exported for network
device bytes and packets has used a 64 bit integer for quite
some time (2.6+ IIRC).  Make the procfs value extraction use
correct types and change internal types used to rate convert
these counters (within the NetworkIO Meter) 64 bit integers,
where appropriate.
2021-03-01 11:55:15 +11:00
Nathan Scott 7433bf4b18 Correctly detect failure to initialize boottime
A zero value for btime (boottime) in /proc/stat is a
real situation that happens, so deal with this case.

Resolves https://github.com/htop-dev/htop/issues/527
2021-02-15 19:32:55 +11:00
Nathan Scott 8cd90f0c4a Fix a couple of small spelling mistakes in comments 2021-02-15 12:54:20 +11:00
Christian Göttsche f273bfd083 Linux: restore memory calculation regarding HugePages
Subtract the total amount of huge page memory from total and used memory.

Restores behavior from #450 (see also #447)

Follow-up of 3d497a37
2021-02-09 16:01:05 +01:00
Christian Göttsche 3d497a3760 Linux: overhaul memory partition
Use similar calculation than procps.
Show AvailableMemory in text mode.
Use total minus available memory instead of manually computed used-
memory as fraction part in bar mode (if available).
2021-02-07 12:41:52 +01:00
Christian Göttsche fd4e6b432b Use MainPanel type in State struct
The State struct holds a pointer to the main process panel.
Use the distinct MainPanel type, to improve maintainability regrading
its usage.
This avoids usages of down-casts from Panel to MainPanel, only up-casts
from MainPanel to Panel are now required.
2021-02-05 14:12:49 +01:00
Daniel Lange ef87877826 Fix typo, align with man page, drop dots 2021-02-02 10:08:59 +01:00
Daniel Lange de3e271206 Merge branch 'comm' of cgzones/htop
Already in Debian so making sure upstream has it, too
2021-02-02 09:56:32 +01:00
Benny Baumann 12208af777 DiD: Avoid negative cmdlineBasenameOffset 2021-02-01 22:09:39 +01:00
ahgamut 51e79ddc07 [#480] SysArchMeter to view kernel/arch info
At start, SysArchMeter calls the uname function to obtain the kernel
version and architecture. If available, the distro version is obtained
by calling lsb_release. The obtained values are stored in static
variables and used when updating the meter.
2021-01-31 20:08:09 +01:00
Christian Göttsche 7bfa466abe Linux: silence UBSAN implicit conversions
pgrp and session might be -1

linux/LinuxProcessList.c:312:20: runtime error: implicit conversion from type 'unsigned long' of value 18446744073709551615 (64-bit, unsigned) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:312:20 in
linux/LinuxProcessList.c:314:23: runtime error: implicit conversion from type 'unsigned long' of value 18446744073709551615 (64-bit, unsigned) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:314:23 in
2021-01-30 14:21:26 +01:00
Christian Göttsche 1014e897a7 Linux: document /proc/PID/stat field parsing 2021-01-30 14:21:26 +01:00
Christian Göttsche 69efa94f9f Use String_eq wrapper instead of raw strcmp 2021-01-30 14:21:26 +01:00
Christian Göttsche fdaa15bd8d Linux: overhaul io process fields
- avoid UBSAN conversions
- print N/A on no data (i.e. as unprivileged user)
- fix rate calculation to show bytes (instead of a thousandth)
- print bytes as human number (i.e. 8MB) instead of 8388608
- stabilize sorting by adjusting NAN values to very tiny negative number
2021-01-30 14:21:26 +01:00
Christian Göttsche a3c8285237 Refactor to tty_nr process field display
If no terminal name can be found, fall back to generic display method
with major and minor device numbers.

Print special value '(none)' in case both are zero.
2021-01-30 14:21:26 +01:00
Christian Göttsche 03d6345c89 Process: document process fields
Drop unused fields 'flags' and 'exit_signal'
2021-01-30 14:21:26 +01:00