summaryrefslogtreecommitdiffstats
path: root/Process.h
Commit message (Collapse)AuthorAgeFilesLines
* Use size_t as type for buffer length in ProcessChristian Göttsche2020-12-061-1/+1
|
* IWYU updateChristian Göttsche2020-12-061-1/+0
|
* Implement sorting in tree modeMaxim Zhiburt2020-12-021-0/+5
|
* Calculate library size (M_LRS column) from maps fileFynn Wulf2020-11-261-1/+3
|
* Fix crash when getCommandStr not overloaded for a platform processChristian Göttsche2020-11-261-1/+1
| | | | Closes: #343
* Cleanup some documentationNarendran Gopalakrishnan2020-11-241-1/+1
|
* Improving Command display/sortNarendran Gopalakrishnan2020-11-241-1/+5
|
* Rename virtual memory column from M_SIZE to M_VIRTChristian Göttsche2020-11-211-2/+2
| | | | Closes: #325
* IWYU update (Linux)Christian Göttsche2020-11-191-1/+0
|
* Add process column for normalized CPU usageChristian Göttsche2020-11-161-0/+1
| | | | Shows the process CPU usage divided by the number of CPU cores
* Address items from reviewAdam Saponara2020-10-311-1/+2
|
* Highlight new and old processes (#74)Adam Saponara2020-10-301-1/+10
|
* Implement Process_getParentPid and Process_isChildOf as functionsChristian Göttsche2020-10-281-2/+6
| | | | Make it more readable and fix unenclosed macro arguments
* Hold only a const version of Settings in ProcessChristian Göttsche2020-10-261-3/+3
|
* Mark user field of Process constChristian Göttsche2020-10-221-1/+1
| | | | It's a non-owning pointer to a hashtable entry.
* IWYU updateChristian Göttsche2020-10-201-1/+2
| | | | | | | | | | | - 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
* Cache PAGE_SIZEChristian Göttsche2020-10-191-7/+0
| | | | | | man:sysconf(3) states: The values obtained from these functions are system configuration constants. They do not change during the lifetime of a process.
* Make all required includes explicitBenny Baumann2020-10-181-4/+8
| | | | Information as seen by IWYU 0.12 + clang 9 on Linux
* Refactor generating starttime string into Process classChristian Göttsche2020-10-161-0/+2
|
* Mark Object pointer to _display function constChristian Göttsche2020-10-101-3/+3
|
* Mark process argument of Process_isThread constChristian Göttsche2020-10-091-1/+1
|
* Mark Object instances constChristian Göttsche2020-10-071-1/+1
|
* Mark Object classes and Object class fields constChristian Göttsche2020-10-071-1/+1
|
* Update License consistently to GPLv2 as per COPYING fileDaniel Lange2020-10-051-1/+1
|
* Merge branch '0000/int-sizes/00' of https://github.com/mfwitten/htop into ↵Nathan Scott2020-10-051-5/+5
|\ | | | | | | mfwitten-0000/int-sizes/00
| * Process.{h,c}: Use integer types that are more portableMichael Witten2020-09-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building on a 32-bit system, the compiler warned that the following line uses a constant whose value is the overflow result of a compile-time computation: Process.c (line 109): } else if (number < 10000 * ONE_M) { Namely, this constant expression: 10000 * ONE_M was intended to produce the following value: 10485760000 However, the result overflowed to produce: 1895825408 The reason for this overflow is as follows: o The macros are expanded: 10000 * (ONE_K * ONE_K) 10000 * (1024L * 1024L) o The untyped constant expression "10000" is typed: 10000U * (1024L * 1024L) o The parenthesized expression is evaluated: 10000U * (1048576L) o The left operand ("10000U") is converted: 10000L * (1048576L) Unbound by integer sizes, that last multiplication would produce the following value: 10485760000 However, on a 32-bit machine, where a long is 32 bits (really 31 bits when talking about positive numbers), the maximum value that can be computed is 2**31-1: 2147483647 Consequently, the computation overflows. o The compiler produces a long int value that is the the result of overflow (10485760000 % 2**31): 1895825408L Actually, I think this overflow is implementation-defined, so it's not even a portable description of what happens. The solution is to use a long long int (or, even better, an unsigned long long int) type for the constant expression; the C standard mandates a sufficiently large maximum value for such types. Hence, the following change is made to the bad line: - } else if (number < 10000 * ONE_M) { + } else if (number < 10000ULL * ONE_M) { However, the whole line is now patently silly, because the variable "number" is typed "unsigned long", and so it will always be less than the constant expression (the compiler will warn about this, too). Hence, "number" must be typed "unsigned long long"; however, this necessitates changing all of the string formats from something like "%lu" to something like "%llu". Et voila! This commit is born. Then, for the sake of completeness, the declared types of the constant-expression macros are updated: o ONE_K is made unsigned (a "UL" instead of "L") o ONE_T is computed by introducing "1ULL *" o Similar changes are made for ONE_DECIMAL_{K,T} Also, a non-portable overflow-conversion to a signed value has been replaced with a portable comparison: - if ((long long) number == -1LL) { + if (number == ULLONG_MAX) { It might be worth reviewing the rest of the code for other cases where overflows are not handled correctly; even at runtime, it's often necessary to check for overflow unless such behavior is expected (especially for signed integer values, for which overflow has implementation-defined behavior).
* | Sort headers/includesBenny Baumann2020-09-291-2/+2
|/
* Drop redundant declarationsChristian Göttsche2020-09-291-6/+0
| | | | | | | | - `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
* Drop dead process fieldsChristian Göttsche2020-09-241-19/+0
| | | | They are nowhere used.
* Use strict function prototypesChristian Göttsche2020-09-181-1/+1
| | | | int foo(); declares a function taking any number of arguments.
* Clean up some code duplication in the header filesHugo Musso Gualandi2020-09-121-4/+0
| | | | | | | | | | | | | PR htop-dev/htop#70 got rid of the infrastructure for generating header files, but it left behind some code duplication. Some of cases are things that belong in the header file and don't need to be repeated in the C file. Other cases are things that belong in the C file and don't need to be in the header file. In this commit I tried to fix all of these that I could find. When given a choice I preferred keeping things out of the header file, unless they were being used by someone else.
* Remove superfluous 'extern's from function declarations.Zev Weiss2020-09-031-15/+15
| | | | | | | | Applied via: $ find * -name '*.h' -exec sed -i -r 's/^extern (.+\()/\1/;' {} + Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
* Axe automated header generation.Zev Weiss2020-09-031-2/+0
| | | | | | | | | | | | | | 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.
* Avoid discarding const qualifiersChristian Göttsche2020-08-251-1/+1
|
* Merge branch 'hishamhm-pull-866'Nathan Scott2020-08-201-2/+1
|\
| * Remove unnecessary HAVE_SYS_SYSMACROS_H checkWataru Ashihara2018-12-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Resolve compiler warnings and errors relating to the Arg unionNathan Scott2020-08-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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 (?).
* | Merge branch 'hishamhm-pull-869'Nathan Scott2020-08-191-0/+2
|\ \
| * | Deal with larger numbers in colorNumber and outputRateadrien10182018-12-301-0/+2
| |/
* / Re-generate all headers with latest scripts/MakeHeader.pyNathan Scott2020-08-181-15/+15
|/ | | | Sync-up missing extern declarations for many functions.
* Collapse current subtree pressing BackspaceHisham Muhammad2018-04-051-0/+2
|
* Updates to generated header filesHisham Muhammad2018-02-261-0/+5
|
* Replace size_t with int/void* unionHisham Muhammad2018-02-181-2/+2
| | | | | | | | 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
* Add support for Linux TASK_IDLEVladimir Panteleev2018-02-041-0/+2
| | | | | | | | | | | | | | 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.
* Make 'c' key work with threads as well.Hisham Muhammad2017-09-141-0/+2
|
* Silence cast warning.Hisham2016-05-301-0/+1
|
* Reuse comm object if possible, avoid useless repetitions of free+strdup.Hisham2016-02-021-0/+1
|
* Extend buffer for reading lines from /proc.Hisham Muhammad2015-12-141-0/+2
| | | | | Apparently a line longer than 255 chars was spotted in the wild: http://serverfault.com/questions/577939/linux-ps-htop-show-processes-running-for-hundreds-or-thousands-of-days-though-h#comment676098_577939
* Remove duplicate declaration.Jardel Weyrich2015-09-101-2/+0
|
* Make column width calculation dynamic.Hisham Muhammad2015-08-201-3/+11
| | | | Closes #228.

© 2014-2024 Faster IT GmbH | imprint | privacy policy