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
Benny Baumann
81543253cf
Fix misaligned access inside taskstats structure
...
Reported by UB sanitizer (alongside several other messages):
linux/LinuxProcessList.c:782:25: runtime error: member access within misaligned address 0x614000000264 for type 'struct taskstats', which requires 8 byte alignment
0x614000000264: note: pointer points here
64 01 03 00 0a 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 4b c8 2e 00 00 00 00 00 3e 45 3c fd
^
The issue doesn't cause trouble on x86, but any architecture with stricter memory alignment requirements may inadvertedly break.
2020-10-18 17:20:34 +02:00
Benny Baumann
872e542f4e
Rename StringUtils.[ch] to XUtils.[ch]
2020-10-16 20:30:21 +02:00
Benny Baumann
c6f04a9c5d
Move xAsprintf, xSnprintf and xStrdup to StringUtils.h
2020-10-16 20:29:45 +02:00
Christian Göttsche
7cd093ce95
Add NetworkIOMeter
2020-10-16 20:00:14 +02:00
Christian Göttsche
a63cfc8b7c
Refactor generating starttime string into Process class
2020-10-16 19:23:40 +02:00
Christian Göttsche
783be7711d
Do not use extra starttime process field on Linux
2020-10-16 19:23:40 +02:00
Christian Göttsche
d744dac7ee
Add SELinuxMeter
2020-10-16 19:20:07 +02:00
Christian Göttsche
7af06659e2
Mark remaining classes const
2020-10-13 14:56:01 +02:00
Christian Göttsche
25022c219d
Read CPU count every cycle to avoid issues when HT/SMT mode changes
2020-10-12 13:15:23 +02:00
Benny Baumann
601480003f
Centralise fault handling
...
This should be done as all platforms essentially did the same anyway and there was nothing platform specific.
2020-10-12 13:06:12 +02:00
Christian Göttsche
79ad39c718
Mark Object pointer to _display function const
2020-10-10 11:25:19 +02:00
Christian Göttsche
41eea8a355
Mark process argument of Process_isThread const
2020-10-09 10:18:40 +02:00
Benny Baumann
2970cae543
Handle parsing envID & VPid from process status file
...
Fixes #55
Fixes #192
2020-10-07 13:14:39 +02:00
Christian Göttsche
ba282cfe19
Mark Object instances const
2020-10-07 13:01:53 +02:00
Christian Göttsche
08d85e6143
Mark Object classes and Object class fields const
2020-10-07 13:01:53 +02:00
Christian Göttsche
954d6c12f5
Simplify statm parsing and document unused fields
2020-10-06 18:59:02 +02:00
Christian Göttsche
ad3acfc847
Handle Panel_getSelected() returning NULL
...
Found by compiling with LTO:
ColumnsPanel.c: In function ‘ColumnsPanel_eventHandler’:
ColumnsPanel.c:46:59: error: potential null pointer dereference [-Werror=null-dereference]
46 | ((ListItem*)Panel_getSelected(super))->moving = this->moving;
| ^
AvailableColumnsPanel.c: In function ‘AvailableColumnsPanel_eventHandler’:
AvailableColumnsPanel.c:31:8: error: potential null pointer dereference [-Werror=null-dereference]
31 | int key = ((ListItem*) Panel_getSelected(super))->key;
| ^
AvailableMetersPanel.c: In function ‘AvailableMetersPanel_eventHandler’:
AvailableMetersPanel.c:40:24: error: potential null pointer dereference [-Werror=null-dereference]
40 | int param = selected->key & 0xff;
| ^
linux/IOPriorityPanel.c: In function ‘IOPriorityPanel_getIOPriority’:
linux/IOPriorityPanel.c:37:11: error: potential null pointer dereference [-Werror=null-dereference]
37 | return (IOPriority) ( ((ListItem*) Panel_getSelected(this))->key );
| ^
2020-10-06 11:17:23 +02:00
Nathan Scott
e9fa290019
Merge branch 'update-license-and-copyright-info'
2020-10-06 10:27:38 +11:00
Michael F. Schönitzer
d93cac12be
Add a date and datetime meter ( #159 )
...
Add a date meter and sort header and source files in Makefile
Change the lists of header and source files sorted alphabetical and one
file per line. This way diffs become better readable and merges easier.
2020-10-05 13:52:58 +02:00
Daniel Lange
079c2abf8e
Update License consistently to GPLv2 as per COPYING file
2020-10-05 10:13:12 +02:00
Christian Göttsche
42946ec113
Introduce ARRAYSIZE
2020-10-03 19:05:40 +02:00
Christian Göttsche
d69585b82a
Resolve DEBUG compilation issues
...
Use NDEBUG conditional instead of DEBUG.
Do not call static functions in extern inline ones.
Vector.c:67:11: error: static function 'Vector_isConsistent' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
2020-10-03 19:04:27 +02:00
Christian Göttsche
e518459981
Add DiskIOMeter for IO read/write usage
2020-10-03 19:01:38 +02:00
Christian Göttsche
6f387008cb
Add security attribute process column
2020-10-03 18:51:17 +02:00
Christian Göttsche
241e4b3dbf
Drop redundant declarations
...
- `CRT_fatalError()` is declared twice in CRT.h
- `Process_pidFormat`, `Process_writeField()` and `Process_compare` are
declared twice in Process.h
- `btime` is defined in LinuxProcess.c and also declared in
LinuxProcess.h, so drop in LinuxProcessList.h
2020-09-29 10:44:42 +02:00
Christian Göttsche
7ae967a04b
Drop redundant return statements
2020-09-29 10:44:42 +02:00
Christian Göttsche
843949131a
Drop redundant casts to the same type
2020-09-29 10:44:42 +02:00
multi
9ee72568dc
CPUMeter: add octuple-column CPU meters.
...
This is a straightforward extension of the existing multi-column CPU meter
code, which now allows for up CPU meters to be displayed in up to 16 columns.
This also adds the meter declarations to all the platform-specific code.
2020-09-28 14:35:35 +02:00
Nathan Scott
400178a89b
Merge branch 'arc-is-not-cache' of https://github.com/multiplexd/htop into multiplexd-arc-is-not-cache
2020-09-28 14:44:12 +10:00
multi
dfa40ad0eb
Linux: consider the ZFS ARC to be cache.
...
This commit is based on a patch originally by @edef1c. The ZFS ARC is a cache
(it's in the name), which will be evicted by the kernel if memory pressure so
requires. Hence, the ARC should not be counted towards a system's total used
memory, and should instead be grouped with the other caches in the system.
Signed-off-by: edef <edef@edef.eu>
2020-09-24 23:27:27 +01:00
Christian Göttsche
18b1e9fba9
Do not drop qualifier in cast
...
ListItem.c:73:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual]
ListItem* obj1 = (ListItem*) cast1;
^
ListItem.c:74:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual]
ListItem* obj2 = (ListItem*) cast2;
^
Process.c:434:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Process* p1 = (Process*)v1;
^
Process.c:435:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Process* p2 = (Process*)v2;
^
Process.c:441:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Settings *settings = ((Process*)v1)->settings;
^
Process.c:443:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p1 = (Process*)v1;
^
Process.c:444:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p2 = (Process*)v2;
^
Process.c:446:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p2 = (Process*)v1;
^
Process.c:447:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p1 = (Process*)v2;
^
AffinityPanel.c:37:16: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual]
free((void*)this->text);
^
AffinityPanel.c:39:19: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual]
free((void*)this->indent);
^
linux/LinuxProcess.c:294:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Settings *settings = ((Process*)v1)->settings;
^
linux/LinuxProcess.c:296:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p1 = (LinuxProcess*)v1;
^
linux/LinuxProcess.c:297:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p2 = (LinuxProcess*)v2;
^
linux/LinuxProcess.c:299:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p2 = (LinuxProcess*)v1;
^
linux/LinuxProcess.c:300:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p1 = (LinuxProcess*)v2;
^
linux/LinuxProcessList.c:62:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual]
TtyDriver* a = (TtyDriver*) va;
^
linux/LinuxProcessList.c:63:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual]
TtyDriver* b = (TtyDriver*) vb;
^
linux/Battery.c:130:21: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
free((char *) isOnline);
^
linux/Battery.c:197:26: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);
^
linux/Battery.c:209:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName);
^
linux/Battery.c:262:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName);
^
2020-09-24 20:14:17 +02:00