Christian Göttsche
e1ce141bc3
Use size_t as len type for Meter_UpdateValues
...
Most of the time the parameter is passed to snprintf type functions
2020-12-06 16:03:44 +01:00
Christian Göttsche
7ba25aa3c4
IWYU update
2020-12-06 15:32:16 +01:00
Benny Baumann
22f8f8000c
Initialize buffer for retrieved path
...
This avoids a warning on GCC 11.
Fixes #369
2020-12-06 11:51:03 +01:00
Christian Göttsche
876194492f
LinuxProcessList: add underscore suffix for raw struct name
...
Fit the general coding style
2020-12-05 20:25:54 +01:00
Christian Göttsche
f61e74a4af
Resolve conversion from ssize_t to int for readlink return value
2020-12-05 19:58:32 +01:00
Christian Göttsche
bc16fa037f
Convert personal copyright authorship to team
2020-12-04 13:55:55 +01:00
Christian Göttsche
d1db9da936
Linux: avoid float division by 0 after system sleep
...
linux/LinuxProcessList.c:1403:63: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:1403:63 in
2020-12-03 13:25:17 +01:00
Christian Göttsche
fe84840314
Add Linux cwd process column
2020-12-03 09:21:28 +01:00
Christian Göttsche
b76eaf187a
Dynamically load libsensors at runtime
2020-12-02 21:03:24 +01:00
Christian Göttsche
f7a8952933
Add xReadfile wrapper for reading small to medium size files
...
Inspired by proposed Linux syscall
Avoid file descriptor leaks like 4af8c63f
2020-12-02 20:39:36 +01:00
Christian Göttsche
1d8192c10b
PressureStallMeter: improve display strings
...
- Shorten name for header setup menu
- Improve caption in bar mode
2020-12-02 19:51:43 +01:00
Christian Göttsche
c0b50164dd
Use String_eq for readability and consistency
2020-12-02 19:14:22 +01:00
Christian Göttsche
7975cd2ca3
Add cast to unsigned char to avoid signed char misuse
2020-12-02 19:14:22 +01:00
Christian Göttsche
9029cc83ad
Merge identical conditional branches
2020-12-02 19:14:22 +01:00
Christian Göttsche
43ee295c23
Drop redundant return statements
2020-12-02 19:14:22 +01:00
Christian Göttsche
9549ca8c88
Linux: fix process parsing for hidden pid directories
2020-11-29 12:46:25 +01:00
Christian Göttsche
5ee6875f73
Typo
2020-11-28 20:53:49 +01:00
Christian Göttsche
ea4f33409a
Update even more snprintfs
...
Use size of actual buffers instead of magic numbers
2020-11-28 19:33:07 +01:00
Benny Baumann
0b29e5074c
Use 'N/A' instead of 'no perm' for more consistency
2020-11-28 17:43:08 +01:00
Daniel Lange
6c306315c8
Fix reading of device nodes > 2 chars from memory maps
2020-11-28 17:06:06 +01:00
Christian Göttsche
2ff2859c23
Add compat mode for systems without openat(2)
2020-11-28 12:35:34 +01:00
Christian Göttsche
638207a2ff
LinuxProcessList: use openat instead of building path strings
...
openat() is available since Linux 2.6.16
2020-11-28 12:35:34 +01:00
Nathan Scott
f704baeb82
Drop unused global ProcessList memory fields
...
The global ProcessList structure contains a couple of unused
fields. 'sharedMem' has never been used by any Meter, since
its not been anything other than zero in Linux /proc/meminfo
for many, many years. The freeMem field is only used in the
usedMem calculation, so it can reside on the stack like some
other memory variables used within-calculations-only and not
exposed to the user via a Meter.
2020-11-27 07:55:58 +01:00
Benny Baumann
2c27f1d9ab
Randomly refresh M_LRS calculation, but latest after 2s
2020-11-26 22:58:34 +01:00
Benny Baumann
08d6e25301
Distinguish display of no permissions for reading M_LRS
2020-11-26 22:58:34 +01:00
Benny Baumann
31044d1729
Roll our own strtoull implementation specialized to handle the parsing requirements
2020-11-26 22:58:34 +01:00
Benny Baumann
cceab5f803
Hardcode actual conversions to read the maps file data
2020-11-26 22:58:34 +01:00
Benny Baumann
721d9112d9
Only calculate M_LRS size every 5 seconds
2020-11-26 22:58:34 +01:00
Fynn Wulf
7f18b352b0
Calculate library size (M_LRS column) from maps file
2020-11-26 22:58:34 +01:00
Christian Göttsche
46a2e8ac63
IOPriorityPanel: drop unnecessary buffer size decrement
...
xSnprintf guarantees null-termination within the passed size.
2020-11-26 20:42:38 +01:00
Christian Göttsche
d62c2e9cca
LinuxProcessList_recurseProcTree: compute time only once and mark parent const
2020-11-25 22:14:35 +01:00
Christian Göttsche
9b31ee5b63
Drop taskstats conditional
...
taskstats is only checked on runtime if the column RCHAR, WCHAR, SYSCR,
SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE or IO_RATE is
selected.
taskstats is currently enabled by default.
Drop the taskstats configuration switch, to reduce the maintenance cost.
2020-11-25 20:49:39 +01:00
Christian Göttsche
c88c80e3bd
Drop cgroup conditional
...
cgroup is only checked on runtime if the column CGROUP is selected.
cgroup is currently disabled by default, but most distributions do
enable it.
Drop the cgroup configuration switch, to reduce the maintenance cost.
2020-11-25 20:49:39 +01:00
Christian Göttsche
c038326a70
LinuxProcessList: fix misspelling
2020-11-25 12:49:17 +01:00
Christian Göttsche
601ad61e7d
Unify naming of first argument of Platform_getBattery
...
Use percent throughout
2020-11-25 12:47:07 +01:00
Christian Göttsche
4af8c63f63
Fix file descriptor leak in LinuxProcessList_readCmdlineFile after xread failure
...
Found by Coverity
2020-11-24 19:54:25 +01:00
Benny Baumann
21e3063e2e
Include comm before cmdline if exe could not be read, but comm mismatches basename from cmdline
...
Also highlights entries where exe was marked deleted
2020-11-24 19:05:48 +01:00
Benny Baumann
46ee28e897
Refactor command string creation
...
Hopefully this patch makes it a bit more approachable how it's done.
2020-11-24 19:05:48 +01:00
Benny Baumann
27b36dab1a
Make kernel thread display for COMM/EXE columns less visible and more consistent
2020-11-24 19:05:48 +01:00
Benny Baumann
f0a232568f
Reduce visual noise to when comm and cmdline actually disagree on the program basename
2020-11-24 19:05:48 +01:00
Narendran Gopalakrishnan
dde2af1fdb
Assume full basename matches COMM when matching full COMM buffer
2020-11-24 19:05:48 +01:00
Narendran Gopalakrishnan
be60419630
Cleanup some documentation
2020-11-24 19:05:48 +01:00
Benny Baumann
fcda517a67
Add heuristic for space-separated cmdline
2020-11-24 19:05:48 +01:00
Benny Baumann
98fce1fb43
Compatibility function for faccessat
2020-11-24 19:05:48 +01:00
Narendran Gopalakrishnan
09fe94da18
Improving Command display/sort
2020-11-24 19:05:48 +01:00
Christian Göttsche
42c842c190
LinuxProcess_adjustTime: simplify by not using double
...
Does not work with -ffast-math else.
2020-11-24 17:30:21 +01:00
Christian Göttsche
952ee9cd77
LinuxProcessList: fix misspelling
2020-11-24 11:46:17 +01:00
Christian Göttsche
6c2849ec81
Linux: fix display of new thread for one cycle when hidden
2020-11-23 14:44:31 +01:00
Nathan Scott
003f2c06a4
Merge branch 'cleanup-init-done' into master
2020-11-23 17:34:44 +11:00
Christian Göttsche
17eeb7573a
LinuxProcessList: skip parsing threads if the kind of thread is disabled
2020-11-22 16:49:43 +01:00
Benny Baumann
03f9a86918
Reduce scope of local variables
2020-11-22 10:08:27 +01:00
Christian Göttsche
fa002c0ba9
Rename virtual memory column from M_SIZE to M_VIRT
...
Closes : #325
2020-11-21 19:39:45 +01:00
Christian Göttsche
3e5cba91ce
LinuxProcess: mark LinuxProcess_printDelay static
2020-11-21 19:26:55 +01:00
Christian Göttsche
7cf5277594
IWYU update (Linux)
2020-11-19 23:51:50 +01:00
Nathan Scott
5d50f43d5f
Add whitespace to improve Linux Platform_init readability
2020-11-19 19:00:00 +11:00
Nathan Scott
c75c5ef9c6
Minor cleanups to platform-specific init and done
...
Move platform-specific code out of the htop.c main function
and into the platform sub-directories - primarily this is
the Linux procfs path check and sensors setup/teardown; not
needed on any other platforms. No functional changes here.
2020-11-19 12:32:07 +11:00
Christian Göttsche
0a2105eb22
Spelling corrections
2020-11-18 13:59:55 +01:00
Nathan Scott
0eb3c7589d
Merge individual Battery.[ch] files into Platform.[ch]
...
Small changes from review - keep headers sorted and keep local
variable declarations at the top of source files.
2020-11-18 10:17:33 +11:00
Nathan Scott
ea9622b8c9
Merge individual Battery.[ch] files into Platform.[ch]
...
Consistent with everything else involving platform-specific
calls from core htop code.
2020-11-18 10:17:33 +11:00
Christian Göttsche
f38af725c2
Silence theoretical memory leak
...
In practice systemctl should never return multiple SystemState= lines.
2020-11-17 13:06:31 +01:00
Daniel Lange
fec9af4e6f
Merge branch 'temperature_v2' of cgzones/htop
...
Closes #111 , closes #49
Closes #93 - thank you for leading the way @DX37 (Maxim Kurnosenko)!
2020-11-17 11:05:15 +01:00
Christian Göttsche
15eab2012d
Add process column for normalized CPU usage
...
Shows the process CPU usage divided by the number of CPU cores
2020-11-16 18:14:06 +01:00
Christian Göttsche
1b225cd7a0
Show CPU temperature in CPU meter
...
Show the CPU temperature in the CPU meter, like CPU frequency, instead
of using an extra Meter.
2020-11-16 16:38:54 +01:00
Christian Göttsche
0411fdbcef
Use spaceship comparison for TTYs
2020-11-15 22:54:14 +01:00
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
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
Christian Göttsche
cd1ba1422b
Avoid bad function cast warning
...
linux/Platform.c:142:17: warning: cast from function call of type 'double' to non-matching type 'int' [-Wbad-function-cast]
return (int) floor(uptime);
^~~~~~~~~~~~~
2020-09-24 20:14:17 +02:00
Christian Göttsche
4296e74ada
Include prototype in Battery implementation
...
linux/Battery.c:291:6: warning: no previous prototype for function 'Battery_getData' [-Wmissing-prototypes]
void Battery_getData(double* level, ACPresence* isOnAC) {
^
2020-09-24 20:14:17 +02:00
Christian Göttsche
edf1b10d2c
Read CPU frequency from sysfs by default
...
Use the more portable sysfs node /sys/devices/system/cpu/cpuX/cpufreq/scaling_cur_freq
to get the CPU frequency.
In case of an error fall back to /proc/cpuinfo .
Also use a fixed width of 4 for the frequency to avoid position jumps
in case the frequency moves in the range 900-1100 MHz.
2020-09-24 20:11:28 +02:00
Christian Göttsche
594409f299
Add DeepCode inline suppression
...
commsize is bounded by the allocated length passed in by commLen, saved
into commLenIn
2020-09-24 19:56:30 +02:00
Benny Baumann
7ecea3d485
Use return value of CLAMP function
2020-09-24 18:06:36 +02:00
Benny Baumann
321960bd96
Update delay accounting to use NAN on error
2020-09-24 18:06:36 +02:00
Benny Baumann
3c65d78d77
Update CPU freq display to use NAN on error
2020-09-24 18:06:36 +02:00
Benny Baumann
d0d3deb73c
Properly query sysconf settting and use NAN if unavailable
...
This also fixes an issue with time returned negative if sysconf(_SC_CLK_TCK) returned an error.
2020-09-24 18:06:36 +02:00
Benny Baumann
29ec115143
Update IO rate display to use NAN on error
2020-09-24 18:06:36 +02:00
Benny Baumann
47e2cefe02
Update battery API to use NAN on error
2020-09-24 18:06:36 +02:00
Christian Göttsche
f9966b5be3
Use checked allocation wrappers
2020-09-23 17:50:21 +02:00
Christian Göttsche
eb260af6bf
Fix memory leak on cgroup read failure
2020-09-21 13:55:29 +02:00
Christian Göttsche
e719a85994
Mark noreturn functions
2020-09-18 12:28:40 +02:00
Christian Göttsche
c3952e7c20
Use strict function prototypes
...
int foo(); declares a function taking any number of arguments.
2020-09-18 12:28:40 +02:00
Christian Göttsche
5d4061732f
Allow third party sigsegv handler
...
For example from sanitizers.
2020-09-17 21:54:21 +02:00
Christian Göttsche
00665e2a2b
Avoid unsigned integer overflow
...
unsigned overflow is well defined, but creates noise when using
sanitizers. unsigned overflow can be a symptom of logic issues of
counter, so its reasonable to use.
linux/LinuxProcessList.c:64:50: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:50 in
linux/LinuxProcessList.c:64:11: runtime error: implicit conversion from type 'unsigned int' of value 4294967295 (32-bit, unsigned) to type 'int' changed the value to -1 (32-bit, signed)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:11 in
linux/LinuxProcessList.c:64:78: runtime error: unsigned integer overflow: 4 - 136 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:78 in
2020-09-17 21:53:31 +02:00
Christian Göttsche
98ee833932
Add Linux process column for context switches
...
Displays the incremental sum of voluntary_ctxt_switches and nonvoluntary_ctxt_switches.
2020-09-17 21:53:15 +02:00
Christian Göttsche
37921382f4
Use PROCDIR throughout instead of /proc on Linux
2020-09-17 21:44:27 +02:00
Christian Göttsche
b096fdbfc0
Avoid potential buffer overflow in LinuxProcessList_readStatFile
...
Pass size of allocated command buffer and limit write.
2020-09-17 21:43:53 +02:00
Christian Göttsche
d5eb72e64d
Drop always true condition
...
`env` is allocated by checked allocation functions and can not be NULL.
This checks confuses clang analyzer and causes a null-dereference
warning on `env[size-1]`.
2020-09-12 18:14:39 +02:00
Nathan Scott
4597332959
Switch variable/field naming from WhiteList to MatchList
2020-09-09 19:38:15 +10:00
Nathan Scott
c5808c56db
Consolidate repeated macro definitions into one header
...
The MIN, MAX, CLAMP, MINIMUM, and MAXIMUM macros appear
throughout the codebase with many re-definitions. Make
a single copy of each in a common header file, and use
the BSD variants of MINIMUM/MAXIMUM due to conflicts in
the system <sys/param.h> headers.
2020-09-09 16:56:04 +10:00
Nathan Scott
8ec5d4a3a0
Further, minor cleanups to headers post-MakeHeaders
...
Remove leftover empty ifdef/endif pairs, whitespace.
The generated htop.h file was also unused - removed.
2020-09-08 17:33:50 +10:00
Zev Weiss
7b7822b896
Remove superfluous 'extern's from function declarations.
...
Applied via:
$ find * -name '*.h' -exec sed -i -r 's/^extern (.+\()/\1/;' {} +
Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
2020-09-03 11:59:26 -05:00
Zev Weiss
a1a027b9bd
Axe automated header generation.
...
Reasoning:
- implementation was unsound -- broke down when I added a fairly
basic macro definition expanding to a struct initializer in a *.c
file.
- made it way too easy (e.g. via otherwise totally innocuous git
commands) to end up with timestamps such that it always ran
MakeHeader.py but never used its output, leading to overbuild noise
when running what should be a null 'make'.
- but mostly: it's just an awkward way of dealing with C code.
2020-09-03 11:58:58 -05:00
Christian Göttsche
e7f6d1ce5f
Reduce oom cast from long to int
...
Oom values should never be greater then INT_MAX, they should be in the
range 0 - 1000.
Improves: d9a5dd4b91
2020-08-31 11:55:53 +02:00
Nathan Scott
47a7d0bd74
Merge branch 'configure' of https://github.com/cgzones/htop into cgzones-configure
2020-08-31 17:13:37 +10:00
Nathan Scott
b321177b08
Merge branch 'master' of github.com:htop-dev/htop
2020-08-31 16:57:46 +10:00
Christian Göttsche
5c99c6e942
Check btime sscanf parse from /proc/stat
...
Found by Coverity
2020-08-28 16:46:50 +02:00
Christian Göttsche
a850d81bf5
Avoid use of uninitialized variables
...
Found by Coverity
2020-08-28 16:46:50 +02:00
Christian Göttsche
05a5fdc47f
Ignore sscanf return value of /proc/stat
...
Found by Coverity
2020-08-28 16:46:50 +02:00
Christian Göttsche
af84d3dfa9
Fail on out-of-range CPU number
...
Found by Coverity
2020-08-28 16:46:50 +02:00
Christian Göttsche
d9a5dd4b91
Improve OOM output
...
* Fix sort by adding cast
* Shrink column size to 4
* Drop unnecessary maximum field width specifier in sscanf
2020-08-28 14:24:59 +02:00
Christian Göttsche
a48ce9d103
Really tell gcc to ignore return value of fscanf
2020-08-28 13:10:41 +02:00
Nathan Scott
b992d52bcf
Increae the size of sysfs power supply path buffers
...
Resolves https://github.com/htop-dev/htop/issues/15
2020-08-28 16:57:21 +10:00
Christian Göttsche
4e2b9f0965
Avoid shadowing warnings
2020-08-25 12:01:56 +02:00
Christian Göttsche
6b11769448
Avoid conversion warning
...
linux/Platform.c:47:90: error: implicit conversion from ‘enum LinuxProcessFields’ to ‘enum ProcessFields’ [-Werror=enum-conversion]
47 | ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
|
2020-08-25 11:59:53 +02:00
Nathan Scott
6900e57efd
Updates to project URLs in docs and embedded in source code
2020-08-22 15:47:11 +10:00
Nathan Scott
5dad65ac2a
Update header files to match whitespace changes in source files
2020-08-22 15:46:31 +10:00
Christian Göttsche
b92f62f912
Remove trailing whitespaces
2020-08-21 10:37:33 +02:00
Christian Göttsche
3856bf574b
Introduce xAsprintf as checked version of asprintf
2020-08-21 10:37:29 +02:00
Nathan Scott
9a55efc8b5
Merge branch 'hishamhm-pull-920'
2020-08-20 18:24:35 +10:00
Nathan Scott
31391b206c
Merge branch 'hishamhm-pull-1012'
2020-08-20 15:51:21 +10:00
Nathan Scott
fed14a584d
Merge branch 'hishamhm-pull-970'
2020-08-20 15:33:30 +10:00
Nathan Scott
6b443c5da9
Merge branch 'hishamhm-pull-932'
2020-08-20 14:47:07 +10:00
Nathan Scott
a82fd262d7
Merge branch 'hishamhm-pull-960'
2020-08-20 14:19:53 +10:00
Nathan Scott
cdff8aea2a
Merge branch 'hishamhm-pull-946'
2020-08-20 14:13:07 +10:00
Nathan Scott
0f76359e4e
Merge branch 'hishamhm-pull-890'
2020-08-20 14:01:47 +10:00
Nathan Scott
2be0992700
Merge branch 'hishamhm-pull-890'
2020-08-20 14:00:13 +10:00
Nathan Scott
45ae6191c1
Merge branch 'hishamhm-pull-866'
2020-08-20 12:29:25 +10:00
Nathan Scott
e7d2f9383a
Merge branch 'hishamhm-pull-857'
2020-08-20 09:47:13 +10:00
Nathan Scott
500fb283e9
Resolve compiler warnings and errors relating to the Arg union
...
Promote the Arg union to a core data type in Object.c such
that it is visible everywhere (many source files need it),
and correct declarations of several functions that use it.
The Process_sendSignal function is also corrected to have
the expected return type (bool, not void) - an error being
masked by ignoring this not-quite-harmless warning. I've
also added error checking to the kill(2) call here, which
was previously overlooked / missing (?).
2020-08-20 09:35:33 +10:00
Nathan Scott
eef6bc447d
Correction to smaps buffer size passed to smaps path snprintf
2020-08-19 17:50:43 +10:00
Nathan Scott
f9625cacf0
Merge branch 'hishamhm-pull-843'
2020-08-19 17:47:38 +10:00
Nathan Scott
7ac1c709b7
Re-generate all headers with latest scripts/MakeHeader.py
...
Sync-up missing extern declarations for many functions.
2020-08-18 17:41:49 +10:00
Nathan Scott
579995c7c2
Merge branch 'hishamhm-pull-842'
2020-08-18 17:35:56 +10:00
Nathan Scott
dfd9279f87
Resolve complation issues with -fno-common (default from gcc-10)
...
Extends the MakeHeader script to auto-generate correct "extern"
function declarations in some cases that it currently does not.
Related to https://github.com/hishamhm/htop/pull/981
2020-07-10 10:35:32 +10:00
Christoph Budziszewski
7fdd8d3732
adding support for more than 2 smaller cpumeter columns
2020-06-11 23:21:52 +02:00
Jure Oder
88c9ebb8f7
Properly identify zombie processes
...
This closes issue #930 .
2019-12-14 11:47:03 +01:00
Daniel Flanagan
dd33444f7e
Clean up existing whitespace
2019-10-31 11:39:12 -05:00
smattie
1886117c72
Linux: fixes sysfs battery discovery
2019-09-07 15:21:04 +01:00
Ross Williams
a267003f2f
Linux fixes
2019-09-03 19:56:38 +00:00
Ross Williams
613556faeb
Support for ZFS Compressed ARC statistics
2019-09-03 18:44:19 +00:00
Ross Williams
e450b58636
Refactor openzfs_sysctl_init() and ZfsArcMeter...
...
openzfs_sysctl_init() now returns void instead of int.
The ZfsArcStats->enabled flag is set inside the init function
now, instead of having to be set from its return value.
Preparation for more flag setting in Compressed ARC commit.
ZfsArcMeter_readStats() added and all Meter->values[] setting
moved to it, eliminating duplicated code in
{darwin,freebsd,linux,solaris}/Platform.c.
2019-09-03 18:21:33 +00:00
Arnavion
81b64691a7
Move sysfs-reading code to LinuxProcessList.c and add average frequency.
...
This way the frequency is read from sysfs only once per update cycle
instead of every time the UI is redrawn.
This also changes the code to read from /proc/cpuinfo instead. This is because
reading from scaling_cur_freq stalls for 10ms if the previous read for the file
was more than one second ago. [1] Since htop's update cycle is
longer than that, it would cause the read of each CPU's scaling_cur_freq file
to block the UI for 20ms. This easily led to a noticeable half-second lag on
a 20+ CPU machine.
/proc/cpuinfo also has a 10ms delay, but this applies for the whole file
so the delay does not scale with the number of CPUs. [2]
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4815d3c56d1e10449a44089a47544d9ba84fad0d
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7d5905dc14a87805a59f3c5bf70173aac2bb18f8
2019-08-10 22:19:32 -07:00
Arnavion
1acfb0a752
Show N/A instead of 0KHz when CPU frequency is not available.
2019-08-10 11:37:35 -07:00
Arnavion
4b0600d8f8
Add new display option to also show CPU frequency in CPU meters.
...
The option is only implemented on Linux. On other platforms, and on Linuxes
that do not expose the relevant sysfs file, the frequency will be 0.
The "CPU average" meter does not show a frequency, only
the individual per-CPU meters.
2019-08-09 21:34:48 -07:00
Ross Williams
a88d2e313d
Refactor common OpenZFS sysctl access
...
Darwin and FreeBSD export zfs kstats through the
same APIs, so moving functions into a common file.
2019-07-07 23:10:54 -04:00
Ross Williams
070fe90461
ZFS arcstats for Linux
...
If no pools are imported (ARC size == 0) or the
ZFS module is not in the kernel (/proc/spl/kstat/zfs/arcstats
does not exist), then the Meter reports "Unavailable".
2019-07-07 22:57:15 -04:00
Alexander Schlarb
078c2ddde5
Linux: Use /proc/*/smaps_rollup for improved PSS parsing speed
2019-03-20 17:00:49 +01:00
Alexander Schlarb
fc0bf546c3
Linux: Add PSS (proportional set size), Swap and SwapPSS calculation
...
Original code was written by *Craig M. Brandenburg* for htop 1.0.2
Many performance improvements by GitHub user *linvinus*, ported to htop 2.0.2
2019-03-20 17:00:41 +01:00
Ran Benita
08feb8585b
Add pressure stall information (PSI) meters on Linux
...
The pressure stall information (PSI) metrics provide useful information
on delays caused by waiting for CPU, IO and memory. Particularly on busy
servers it can provide a quick overview of what's "slowing things down".
This feature is supported on Linux >= 4.20.
The interface is documented here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/accounting/psi.txt
These links provide rationale:
https://lwn.net/Articles/759781/
https://facebookmicrosites.github.io/psi/
The following metrics are added, corresponding to the currently exposed
lines (see `head /proc/pressure/*`):
- PressureStallCPUSome
- PressureStallIOSome
- PressureStallIOFull
- PressureStallMemorySome
- PressureStallMemoryFull
The color scheme is the same as that used for Load Average, however I
gave it separate entries just in case someone wants to change them
specifically.
Tested on 4.20.7-arch1-1-ARCH, on the linux platform.
Also tested that other platforms still compile (changed configure to use
the unsupported platform).
Closes #879 .
2019-02-13 22:38:10 +02:00
wangqr
da60309fc9
Don't follow process when selecting non-process-specific options
...
Disable the follow process logic in Action_pickFromVector(), when
selecting sort order or user filter, since they don't apply on specific
process.
Fix #856
2019-02-12 22:15:51 -05:00
Hisham Muhammad
402e46bb82
Linting changes
...
as reported by lgtm.com
2019-02-10 14:16:46 +01:00
Wataru Ashihara
41754e5632
Remove unnecessary HAVE_SYS_SYSMACROS_H check
...
HAVE_SYS_SYSMACROS_H is always true if MAJOR_IN_SYSMACROS.
This way of checking is recommended in autoconf 2.70 documentation:
https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blobdiff;f=doc/autoconf.texi;h=4f041bd4e;hp=9ad7dc1c5f02c8ba25b2fe1218bf931c7113a5d5;hb=e17a30e987d7ee695fb4294a82d987ec3dc9b974;hpb=565a6dc50cfa01cec2fb4db894026689cdf4970c
NOTE: currently
https://www.gnu.org/software/autoconf/manual/autoconf.html is the
doc for autoconf 2.69.
2018-12-15 22:10:06 +09:00
Daniel Lange
c34be41e1c
Widen ST_UID (UID) column to 5 chars to allow UIDs > 9999 without breaking alignment
...
Issue Github #841 , Debian bug #910492
2018-10-07 11:16:12 +02:00
Hisham Muhammad
bae27054e6
Linux: fix CPU count
2018-08-24 18:38:06 -03:00
Hisham Muhammad
8d01ae2054
Linux: remove warnings of unused variables
2018-08-24 18:38:06 -03:00
Shawn Landden
bd1d719a61
Linux: add process->starttime and use it for STARTTIME column ( #700 )
...
this way a remount of /proc will not reset starttimes
and we can also see startup times for processes started before the mount
of /proc
also record btime (boot time in seconds since epoch) as Linux semi-global
2018-08-19 01:29:03 -03:00
Score_Under
d74b6dc8e0
Fix process name updates for shorter strings ( #812 )
...
When a process name changes from a long string to a short string,
truncate instead of just overwriting the beginning.
2018-07-28 00:08:40 -03:00
Faster IT
e1e3791363
Fix #define to match header when regenerating with MakeHeader.py ( #789 )
...
from Debian https://sources.debian.org/src/htop/2.2.0-1/debian/patches/fix-linux-process.patch/
2018-05-22 23:09:20 -03:00
Hisham Muhammad
47cf1532b0
Linux: change how kernel threads are detected
...
Use the same method that ps and top use to determine if a
process is a kernel thread on Linux: check if cmdline is empty.
Thanks to @wangqr's investigation reported here:
https://github.com/hishamhm/htop/issues/761#issuecomment-375306069
Fixes #761 .
2018-03-25 15:26:05 -03:00
Hisham Muhammad
ccd156f8ba
Updates to generated header files
2018-02-26 11:44:46 -03:00
Kang-Che Sung (宋岡哲)
c01f40eb3e
Fix build failure ('major' undefined) in glibc 2.28. ( #746 )
...
glibc 2.28 no longer defines 'major' and 'minor' in <sys/types.h> and
requires us to include <sys/sysmacros.h>. (glibc 2.25 starts
deprecating the macros in <sys/types.h>.) Now do include the latter if
found on the system.
At the moment, let's also utilize AC_HEADER_MAJOR in configure script.
However as Autoconf 2.69 has not yet updated the AC_HEADER_MAJOR macro
to reflect the glibc change [1], so add a workaround code.
Fixes #663 . Supersedes pull request #729 .
Reference:
[1] https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=e17a30e987d7ee695fb4294a82d987ec3dc9b974
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2018-02-26 10:15:05 -03:00
Hisham Muhammad
8c653212c0
Replace size_t with int/void* union
...
I was occasionally passing negative values to size_t.
Plus, this better reflects the intent of the variant argument.
Reported by Coverity:
https://scan8.coverity.com/reports.htm#v13253/p10402/fileInstanceId=22093891&defectInstanceId=7543346&mergedDefectId=174179&fileStart=251&fileEnd=500
2018-02-18 10:38:49 -03:00
Hisham Muhammad
b064d501ae
linux/Battery.c: make sure fd is always closed
...
Detected by Coverity:
https://scan8.coverity.com/reports.htm#v13252/p10402/fileInstanceId=22093957&defectInstanceId=7543348&mergedDefectId=174180
2018-02-18 10:21:22 -03:00
Hisham Muhammad
6dda8d2586
linux/LinuxProcessList.c: Fix indentation.
2018-02-17 20:52:46 -02:00
Marc Kleine-Budde
70ed51a303
linux/LinuxProcessList: fix reading of number of read syscalls of process
...
The "if" tests if the character at index "5" is 'r', as a first quick
check. However at index "5" will always be a colon ":". This patch fixes
the off-by-one error. htop now shows proper values in the RD_SYSC
column.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-02-17 16:14:34 -02:00
Jan Chren (rindeal)
b0588d90ff
parseBatInfo: check `line` for NULL before passing it to String_getToken()
2018-02-04 17:04:47 +01:00
Vladimir Panteleev
87be623eac
Add support for Linux TASK_IDLE
...
Linux commit 06eb61844d841d0032a9950ce7f8e783ee49c0d0 ("sched/debug:
Add explicit TASK_IDLE printing") exposes kthreads idling using
TASK_IDLE in procfs as "I (idle)".
Until now, when sorting the STATE ("S") column, htop used the raw
value of the state character for comparison, however that led to the
undesirable effect of TASK_IDLE ('I') tasks being sorted above tasks
that were running ('R').
Thus, explicitly recognize the idle process state, and sort it below
others.
2018-02-04 16:44:21 +01:00
André Carvalho
b7b66b76a5
Adds support for linux delay accounting ( #667 )
...
Adds support for showing columns with linux delay accounting.
This information can be read from the netlink interface, and thus we set up a socket to read from that when initializing the LinuxProcessList (LinuxProcessList_initNetlinkSocket). After that, for each process we call LinuxProcessList_readDelayAcctData, which sends a message thru the socket after setting up a callback to get the answer from the Kernel. That callback sets the process total delay time attribute. We then set the delay percent as the percentage of time process cpu time since last scan.
2017-12-04 00:15:29 -02:00
Hisham Muhammad
9487bda330
Do not use xSnprintf when the result is used. Fixes #662 .
2017-08-01 15:48:43 -07:00
Hisham Muhammad
09e241fb12
Security review: check results of snprintf.
...
Calls marked with xSnprintf shouldn't fail.
Abort program cleanly if any of them does.
2017-07-27 16:07:50 -03:00
Hisham Muhammad
3975e9ce5c
Merge branch 'master' of https://github.com/hishamhm/htop
2017-07-26 16:16:10 -03:00
Hisham Muhammad
f205f7004c
Use regular readdir since readdir_r is deprecated and newer GCC complains.
2017-07-26 15:35:39 -03:00
Richard
d5faf64374
Mark some things as const
...
Several string pointer arrays pointed to const strings
but were not const themselves.
A few various structures and arrays were also marked const.
2017-07-22 22:34:30 -05:00
Hisham Muhammad
e940aecfb9
Add "no perm" status when other fields fail due to lack of permission.
...
Thanks @Sworddragon for the heads up.
See #88 .
2017-07-10 20:57:34 -03:00
Hisham Muhammad
71785e2ded
Set idle I/O prio to 0x6007, like ionice.
...
As suggested by @wolfgang42 in #100 .
2017-07-05 15:20:48 -03:00
Hisham Muhammad
e9ecbd05bc
Use class value only to display idle I/O priority.
...
As suggested by @wolfgang42. Fixes #100 .
2017-07-05 15:18:02 -03:00
Hisham
fa30938247
Merge branch 'master' of https://github.com/hishamhm/htop
2017-02-15 22:49:13 -02:00
Hisham
bb8dec1582
Cap battery at 100%.
...
Apparently invalid results can be returned by buggy drivers in old laptops,
as reported by @thukydides. See #596 .
2017-02-15 22:47:03 -02:00
Kamyar Rasta
3f6d1262c0
Issue #502 fix SID colunm header width
2017-02-05 00:10:29 +01:00
Kamyar Rasta
84bc00a275
Issue #502 update Session ID column
2017-02-01 00:03:55 +01:00
Hisham
8af4d9f453
Interpret TTY_NR column on Linux,
...
translate dev_t to major:minor on other platforms.
Closes #316 .
2016-10-01 03:09:04 -03:00
Explorer09
1f3d85b617
Mark signal tables 'const'
...
Specifically, Platform_signals[] and Platform_numberOfSignals. Both are
not supposed to be mutable. Marking them 'const' puts them into rodata
sections in binary. And for Platform_numberOfSignals, this aids
optimization (aids only Link Time Optimization for now). :)
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2016-08-30 20:41:17 +08:00