Commit Graph

2444 Commits

Author SHA1 Message Date
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 a4173f5209 Improve process following
- 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
2021-03-14 14:47:15 +01:00
Christian Göttsche 1275139795 Settings_write: fix return value on error
Return a negative errno on fprintf() or flcose() failure, not a return
value of ferror() or flcose().
2021-03-13 18:15:20 +01:00
Christian Göttsche 23797e730e CPUMeter_init: compactify branches 2021-03-12 17:43:23 +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
Christian Göttsche 521f1343e3 Settings: check if writing configuration file was successful
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.
2021-03-12 16:56:06 +01:00
Christian Göttsche 350b48e44c Meter: do not access RichString internals
Use a temporary local variable
2021-03-12 16:49:45 +01:00
Christian Göttsche c38819a675 Settings: mark non-modified pointer parameters const 2021-03-12 16:48:41 +01:00
Christian Göttsche d37d66bb3a InfoScreen/ProcessList: do not access Vector internals
Use wrapper function to encapsulate the Vector structure
2021-03-12 16:46:55 +01:00
Christian Göttsche 3f99c2de24 Process: do not access RichString internals
Use wrapper macro to encapsulate the RichString structure
2021-03-12 16:46:04 +01:00
Christian Göttsche bea7f8e7af Process_compare: reorder checks
Check for result being 0 first, before checking if the result might be
negated, so we do not need to negate 0.
2021-03-12 16:44:46 +01:00
Christian Göttsche 9adcd9051a Object: always include stdbool.h
The function Object_isA() returning bool is nowadays unconditional
2021-03-12 16:38:36 +01:00
Christian Göttsche 8ba4ef327e configure: use portable AND
man:test(1)
    NOTE: Binary -a and -o are inherently ambiguous.  Use 'test EXPR1 &&
    test EXPR2' or 'test EXPR1 || test EXPR2' instead.

Also fix indent
2021-03-12 16:37:17 +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 b862e36ee7 Separate data-update and drawing of header 2021-03-04 23:57:45 +01:00
Christian Göttsche 2d1042adb3 Save text buffer in Meter 2021-03-04 23:57:45 +01:00
Benny Baumann 23c5b9ce3c Ensure buffer for gethostname(2) is properly terminated 2021-03-04 23:42:24 +01:00
Daniel Lange c5770c26af Merge branch 'follow' of cgzones/htop
Closes #557
2021-03-04 07:41:14 +01:00
Nathan Scott 8c421d527b Resolve trailing-whitespace failure in CI (merge issue) 2021-03-04 15:16:32 +11: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 59a150e8d7 Follow followed process when switching thread visibilities
Do not stop following a process when switching the visibility of
userland or kernel threads.

Related: #557
2021-03-03 20:06:14 +01:00
Daniel Lange 2328e52403 Document PERCENT_NORM_CPU and mention Irix / Solaris modes (top lingo) 2021-03-03 10:46:49 +01:00
Daniel Lange 0bdceb858d Unsupported: add normalized CPU percentage column 2021-03-03 08:44:37 +01:00
Christian Göttsche 4f9cf1490f Darwin: add normalized CPU percentage column
Missed in 15eab2012d
2021-03-03 08:43:45 +01:00
Christian Göttsche 635d4cfe60 Drop newline at end of if branch 2021-03-02 22:37:47 +01: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
Christian Göttsche 979aca98cc Use uppercase floating point literal suffix 2021-03-02 22:03:20 +01:00
Christian Göttsche df818b9904 Use ATTR_UNUSED instead of void casting 2021-03-02 22:03:20 +01:00
Christian Göttsche a40347e85b SysArchMeter: avoid static variable 2021-03-02 16:37:11 +01:00
Nathan Scott dc8124e1a1 Fix compilation of the 'unsupported' platform (Process flags) 2021-03-02 16:01:14 +11: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 3fe297aa97
Merge pull request #549 from natoscott/network-types
Fix integer sizing issues in the NetworkIO Meter
2021-03-02 13:34:36 +11:00
Nathan Scott 88a11859a0 Switch NetworkIO Meter to using uint32_t and uint64_t
From review via @BenBE, this is now a whole lot cleaner.
2021-03-02 12:14:44 +11:00
Nathan Scott b4736228dc Switch DiskIO Meter to using uint32_t and uint64_t
From review via @BenBE, this is now a whole lot cleaner.
2021-03-02 12:09:29 +11:00
Benny Baumann 8a1112141d Fix a possible truncation of the intermediate strings in the SysArch meter 2021-03-01 09:56:07 +01:00
Nathan Scott 7b48fec59a
Merge pull request #533 from cgzones/os-release
SysArchMeter: read os-release instead of running lsb-release
2021-03-01 18:38:53 +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
Daniel Lange 379421d3b2 Merge branch 'networkiograph' of Nudin/htop 2021-02-28 18:44:39 +01:00
Michael F. Schönitzer bb9a60ee8a Implement bar and graph mode for NetworkIOMeter (#408) 2021-02-28 18:36:07 +01:00
Daniel Lange 07a6efcb22 Make the first tree item stable on expand / collapse again
Regression introduced with 06b1674
2021-02-28 18:16:29 +01:00
Michael F. Schönitzer 76350c0350 Rescale graph when value of total is changed 2021-02-28 17:42:10 +01:00
Daniel Lange 12c2337939 Merge branch 'remove-setuid' of BenBE/htop 2021-02-17 17:56:58 +01:00
Benny Baumann 067cd6deb8 Include note in changelog regarding removal of the setuid feature 2021-02-17 17:14:06 +01:00
Benny Baumann 82157f598e Refactor to remove no-op calls
This removes the call-sites of the removed setuid feature
2021-02-17 15:59:50 +01:00
Benny Baumann a73064dda9 Remove setuid support
This support was rarely ever used and has been disabled by default for some time.

As far as the developer team is aware there's no distribution that activated this
feature in their packages by default.
2021-02-17 15:59:50 +01:00
Daniel Lange b1befa3287 Merge branch 'enable-better-debug-on-enable-debug' of fasterit/htop 2021-02-17 15:19:59 +01:00