summaryrefslogtreecommitdiffstats
path: root/linux
AgeCommit message (Collapse)Author
2020-10-07Mark Object classes and Object class fields constChristian Göttsche
2020-10-06Simplify statm parsing and document unused fieldsChristian Göttsche
2020-10-06Handle Panel_getSelected() returning NULLChristian Göttsche
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-06Merge branch 'update-license-and-copyright-info'Nathan Scott
2020-10-05Add a date and datetime meter (#159)Michael F. Schönitzer
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-05Update License consistently to GPLv2 as per COPYING fileDaniel Lange
2020-10-03Introduce ARRAYSIZEChristian Göttsche
2020-10-03Resolve DEBUG compilation issuesChristian Göttsche
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-03Add DiskIOMeter for IO read/write usageChristian Göttsche
2020-10-03Add security attribute process columnChristian Göttsche
2020-09-29Drop redundant declarationsChristian Göttsche
- `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-29Drop redundant return statementsChristian Göttsche
2020-09-29Drop redundant casts to the same typeChristian Göttsche
2020-09-28CPUMeter: add octuple-column CPU meters.multi
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-28Merge branch 'arc-is-not-cache' of https://github.com/multiplexd/htop into ↵Nathan Scott
multiplexd-arc-is-not-cache
2020-09-24Linux: consider the ZFS ARC to be cache.multi
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-24Do not drop qualifier in castChristian Göttsche
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-24Avoid bad function cast warningChristian Göttsche
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-24Include prototype in Battery implementationChristian Göttsche
linux/Battery.c:291:6: warning: no previous prototype for function 'Battery_getData' [-Wmissing-prototypes] void Battery_getData(double* level, ACPresence* isOnAC) { ^
2020-09-24Read CPU frequency from sysfs by defaultChristian Göttsche
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-24Add DeepCode inline suppressionChristian Göttsche
commsize is bounded by the allocated length passed in by commLen, saved into commLenIn
2020-09-24Use return value of CLAMP functionBenny Baumann
2020-09-24Update delay accounting to use NAN on errorBenny Baumann
2020-09-24Update CPU freq display to use NAN on errorBenny Baumann
2020-09-24Properly query sysconf settting and use NAN if unavailableBenny Baumann
This also fixes an issue with time returned negative if sysconf(_SC_CLK_TCK) returned an error.
2020-09-24Update IO rate display to use NAN on errorBenny Baumann
2020-09-24Update battery API to use NAN on errorBenny Baumann
2020-09-23Use checked allocation wrappersChristian Göttsche
2020-09-21Fix memory leak on cgroup read failureChristian Göttsche
2020-09-18Mark noreturn functionsChristian Göttsche
2020-09-18Use strict function prototypesChristian Göttsche
int foo(); declares a function taking any number of arguments.
2020-09-17Allow third party sigsegv handlerChristian Göttsche
For example from sanitizers.
2020-09-17Avoid unsigned integer overflowChristian Göttsche
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-17Add Linux process column for context switchesChristian Göttsche
Displays the incremental sum of voluntary_ctxt_switches and nonvoluntary_ctxt_switches.
2020-09-17Use PROCDIR throughout instead of /proc on LinuxChristian Göttsche
2020-09-17Avoid potential buffer overflow in LinuxProcessList_readStatFileChristian Göttsche
Pass size of allocated command buffer and limit write.
2020-09-12Drop always true conditionChristian Göttsche
`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-09Switch variable/field naming from WhiteList to MatchListNathan Scott
2020-09-09Consolidate repeated macro definitions into one headerNathan Scott
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-08Further, minor cleanups to headers post-MakeHeadersNathan Scott
Remove leftover empty ifdef/endif pairs, whitespace. The generated htop.h file was also unused - removed.
2020-09-03Remove superfluous 'extern's from function declarations.Zev Weiss
Applied via: $ find * -name '*.h' -exec sed -i -r 's/^extern (.+\()/\1/;' {} + Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
2020-09-03Axe automated header generation.Zev Weiss
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-08-31Reduce oom cast from long to intChristian Göttsche
Oom values should never be greater then INT_MAX, they should be in the range 0 - 1000. Improves: d9a5dd4b916636b5e7ba8631885427372f0cfcad
2020-08-31Merge branch 'configure' of https://github.com/cgzones/htop into ↵Nathan Scott
cgzones-configure
2020-08-31Merge branch 'master' of github.com:htop-dev/htopNathan Scott
2020-08-28Check btime sscanf parse from /proc/statChristian Göttsche
Found by Coverity
2020-08-28Avoid use of uninitialized variablesChristian Göttsche
Found by Coverity
2020-08-28Ignore sscanf return value of /proc/statChristian Göttsche
Found by Coverity
2020-08-28Fail on out-of-range CPU numberChristian Göttsche
Found by Coverity
2020-08-28Improve OOM outputChristian Göttsche
* Fix sort by adding cast * Shrink column size to 4 * Drop unnecessary maximum field width specifier in sscanf