Commit Graph

259 Commits

Author SHA1 Message Date
Christian Göttsche
f856fe6463 Early skip non-directories when searching for process information 2020-11-15 22:54:14 +01:00
Christian Göttsche
ad72b747fa Drop hideThreads Setting
It is only used to read process directories on RedHat beginning with a dot.
Unconditionally accept directories with a starting dot.
2020-11-15 22:54:14 +01:00
Christian Göttsche
9f67b95308 Mark local functions static 2020-11-15 18:35:30 +01:00
Christian Göttsche
397b5c4bd0 Introduce spaceship comparison for Processes
If currently two unsigned values are compared via `a - b`, in the case b
is actually bigger than a, the result will not be an negative number (as
-1 is expected) but a huge positive number as the subtraction is an
unsigned subtraction.

Avoid over-/underflow affected operations; use comparisons.
Modern compilers will generate sane code, like:
    xor     eax, eax
    cmp     rdi, rsi
    seta    al
    sbb     eax, 0
    ret
2020-11-15 18:25:21 +01:00
Daniel Lange
f2b2735e07 Resolve merge conflicts, merge #229 "Add SystemdMeter" from @cgzones 2020-11-15 14:52:25 +01:00
Daniel Lange
bb908f3dc4 Resolve merge conflicts, merge #298 "Macro cleanup" from @BenBE 2020-11-15 14:33:09 +01:00
Daniel Lange
da2dcf9505 Remove duplicate test for NUL
Fixes #308, thanks @qarmin (Rafał Mikrut)
2020-11-15 14:16:23 +01:00
Benny Baumann
d431786fca Split data array for file lock information into separate fields 2020-11-14 15:51:26 +01:00
Benny Baumann
18763051a2 Split platform dependent parts for file locks screen 2020-11-14 15:51:26 +01:00
Benny Baumann
2d6da2e520 Add compat wrapper for readlinkat 2020-11-09 19:17:57 +01:00
Fynn Wulf
84dad4c38e Implement screen for active file locks 2020-11-09 19:17:57 +01:00
Benny Baumann
e7b95feee4 Remove unnecessary braces 2020-11-02 22:15:01 +01:00
Benny Baumann
0e922d4085 Integrate NAN check into assignment
The check for NAN is kept to avoid relying on implementation details of the CLAMP macro/function
2020-11-02 22:15:01 +01:00
Benny Baumann
0d64ca9262 Wrap inline structure definitions 2020-11-02 22:15:01 +01:00
Benny Baumann
45869513bf Embracing branches 2020-11-02 22:15:01 +01:00
Benny Baumann
61e14d4bb2 Spacing around operators 2020-11-02 22:15:01 +01:00
Benny Baumann
b23f8235e2 Whitespace and indentation issues 2020-11-02 22:15:01 +01:00
Benny Baumann
9a16b1079e Make scope of match macro symmetric 2020-11-02 22:15:01 +01:00
Benny Baumann
493217e814 Fix indentation to 3 spaces 2020-11-02 22:15:01 +01:00
Benny Baumann
adf797c295 Spacing after keywords (for) 2020-11-02 22:15:01 +01:00
Benny Baumann
374edb9ed5 Spacing after keywords (if) 2020-11-02 22:14:59 +01:00
Benny Baumann
0a51eae11f Spacing after keywords (while) 2020-11-02 22:14:26 +01:00
Benny Baumann
c790b6ae67 Remove accidental syntax collision 2020-11-02 22:14:26 +01:00
Benny Baumann
7ab0915a6c Remove unnecessary trailing semicolon on macros 2020-11-02 22:14:26 +01:00
Christian Göttsche
15652e7b81 Enclose macro arguments in parentheses 2020-10-31 19:54:03 +01:00
Christian Göttsche
2a9e8ca074 Add SystemdMeter 2020-10-31 19:51:42 +01:00
Murloc Knight
ab17ef4dc0 Zram Meter feature 2020-10-31 18:51:53 +01:00
Christian Goettsche
c2fdfd99eb FreeBSD: implement Platform_getDiskIO() 2020-10-29 22:21:42 +01:00
Christian Göttsche
76797f8d92 Implement Process_isUserlandThread as function
Make it more readable and fix unenclosed macro arguments
2020-10-28 19:57:10 +01:00
Christian Göttsche
d33b2be2ca Implement LinuxProcess_effectiveIOPriority as function
Make it more readable and fix unenclosed macro arguments
2020-10-28 19:57:10 +01:00
Christian Göttsche
8c1f5c5a6f Enclose macro arguments in parentheses 2020-10-28 19:57:10 +01:00
Benny Baumann
cf1a9ec180 Refactor LinuxProcessList_readSmapsFile to work line-oriented 2020-10-28 19:46:23 +01:00
Christian Göttsche
ac2b07eddd Avoid some unnecessary casts and mark some not changing variables const 2020-10-27 18:00:43 +01:00
Christian Göttsche
27870bd4de Drop unneeded variablw initialization and reduce scope 2020-10-27 18:00:43 +01:00
Benny Baumann
c98d4577c9 Refactor code for reading process environment from procfs 2020-10-27 17:54:37 +01:00
Christian Göttsche
a3bb7cbe64 Hold only a const version of Settings in ProcessList 2020-10-26 19:30:38 +01:00
Christian Göttsche
4eb443926f Hold only a const version of Settings in Process 2020-10-26 19:30:38 +01:00
Christian Göttsche
7109172431 Mark process parameter of Process_writeField consistently const 2020-10-26 19:30:38 +01:00
Christian Göttsche
72103e9613 Hold only a const version of the ProcessList in Meters 2020-10-26 19:30:38 +01:00
Christian Göttsche
f757810f48 Improve handling of no data in Disk and Network IO Meters 2020-10-26 19:17:14 +01:00
Jan Palus
167adc0a2b Parse POWER_SUPPLY_CAPACITY
If POWER_SUPPLY_{CHARGE,ENERGY}_NOW is missing then try to use
POWER_SUPPLY_CAPACITY to determine current charge level.
2020-10-26 19:03:09 +01:00
Christian Göttsche
e12d48a661 Fix wrong strncmp replacement
Fixes 4c66eb6d4c
2020-10-20 22:30:13 +02:00
Christian Göttsche
7429c22201 Drop unnecessary cast 2020-10-20 22:29:16 +02:00
Christian Göttsche
8a08a3209c IWYU update
- Add Settings forward declaration in Process.h
- Add assert.h include in XUitls.c
- Add conditional stdbool.h include in Object.h
- Drop unneeded stddef.h include in Richstring.c
- Drop unneeded unistd.h include in Process.h
- Drop unneeded string.h include in linux/Platform.c
- Use String_eq to avoid string.h include in Action.c
- Improve script to run custom iwyu version
2020-10-20 21:44:25 +02:00
Daniel Lange
0ea18a6edb Merge branch 'Xalloc_Cleanup' of cgzones/htop 2020-10-20 10:23:47 +02:00
Daniel Lange
9f1a9ab2c2 Merge branch 'header_pause' of cgzones/htop
Continue to update generic data in paused mode
2020-10-20 10:17:58 +02:00
Christian Göttsche
4c66eb6d4c XUtils string related updates
- allow count out-parameter of String_split() to be NULL
- introduce xStrndup()
- do not allow NULL pointers passed to String_eq()
  it is not used in any code
- implement String_startsWith(), String_contains_i() and String_eq()
  as inline header functions
- adjust several conversion issues
2020-10-19 15:38:45 +02:00
Christian Göttsche
96e2a4259e Continue to update generic data in paused mode
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: #214
Closes: #253
2020-10-19 14:45:39 +02:00
Christian Göttsche
361877454f Cache PAGE_SIZE
man:sysconf(3) states:
    The values obtained from these functions are system configuration constants.
    They do not change during the lifetime of a process.
2020-10-19 14:42:35 +02:00
Benny Baumann
0f5262917f Make all required includes explicit
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-18 20:09:05 +02:00