Benny Baumann
374edb9ed5
Spacing after keywords (if)
2020-11-02 22:14:59 +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
ac2b07eddd
Avoid some unnecessary casts and mark some not changing variables const
2020-10-27 18:00:43 +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
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
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
783be7711d
Do not use extra starttime process field on Linux
2020-10-16 19:23:40 +02:00
Christian Göttsche
7af06659e2
Mark remaining classes const
2020-10-13 14:56:01 +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
954d6c12f5
Simplify statm parsing and document unused fields
2020-10-06 18:59:02 +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
6f387008cb
Add security attribute process column
2020-10-03 18:51:17 +02:00
Christian Göttsche
843949131a
Drop redundant casts to the same type
2020-09-29 10:44:42 +02: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
Benny Baumann
321960bd96
Update delay accounting to use NAN on 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
Christian Göttsche
eb260af6bf
Fix memory leak on cgroup read failure
2020-09-21 13:55:29 +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
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
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
b92f62f912
Remove trailing whitespaces
2020-08-21 10:37:33 +02:00
Nathan Scott
a82fd262d7
Merge branch 'hishamhm-pull-960'
2020-08-20 14:19:53 +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
f9625cacf0
Merge branch 'hishamhm-pull-843'
2020-08-19 17:47:38 +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
Daniel Flanagan
dd33444f7e
Clean up existing whitespace
2019-10-31 11:39:12 -05: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
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
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
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
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
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
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
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
Hisham
797bcd0961
Catch invalid IO values due to no permissions.
...
Display them properly. Not fully convinced of the "no perm" message...
2016-02-20 02:23:26 -02:00
Hisham
35657208d7
Disable the syscall on systems that don't have it.
...
Got a report in #397 that htop runs in NetBSD
masquerading as Linux and using a compatibility /proc
(like we used to in FreeBSD) and that it builds fine
apart from this syscall.
2016-02-14 12:05:35 -02:00
Hisham
b54d2dde40
Check for failure in allocations.
2016-02-02 15:53:02 +01:00
Christian Hesse
e8970b6f32
fix calloc() calls
...
* size_t nmemb (number of elements) first, then size_t size
* do not assume char is size 1 but use sizeof()
* allocate for char, not pointer to char (found by Michael McConville,
fixes #261 )
2015-09-07 07:52:39 +02:00
Hisham Muhammad
9428010121
Make column width calculation dynamic.
...
Closes #228 .
2015-08-20 00:32:47 -03:00
Maks Naumov
1bdee6b6ba
Fix sort by cstime
2015-07-23 14:24:39 +03:00