summaryrefslogtreecommitdiffstats
path: root/CRT.h
AgeCommit message (Collapse)Author
2021-09-03NetBSD: color process state P as runningChristian Göttsche
On NetBSD state 'R' means runnable not running. Improve the color identifier name accordingly.
2021-08-16Reset the signal handlers at program exitChristian Göttsche
The signal handler will access the Settings struct, which gets freed at normal program finalization. When using leak sanitizers with ASAN_OPTIONS=abort_on_error=1, which runs after program termination, any leak causes SIGABRT to be raised, calling the crash handler, which will derefernce the freed Settings. ==44741==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d000000080 at pc 0x0000005680df bp 0x7fffe335e960 sp 0x7fffe335e958 READ of size 8 at 0x60d000000080 thread T0 #0 0x5680de in Settings_write /home/christian/Coding/workspaces/htop/Settings.c:329:26 #1 0x4f77b7 in CRT_handleSIGSEGV /home/christian/Coding/workspaces/htop/CRT.c:1020:4 #2 0x7f8a1120c13f (/lib/x86_64-linux-gnu/libpthread.so.0+0x1413f) #3 0x7f8a11042ce0 in __libc_signal_restore_set signal/../sysdeps/unix/sysv/linux/internal-signals.h:86:3 #4 0x7f8a11042ce0 in raise signal/../sysdeps/unix/sysv/linux/raise.c:48:3 #5 0x7f8a1102c536 in abort stdlib/abort.c:79:7 #6 0x4c3db6 in __sanitizer::Abort() (/home/christian/Coding/workspaces/htop/htop+0x4c3db6) #7 0x4c2090 in __sanitizer::Die() (/home/christian/Coding/workspaces/htop/htop+0x4c2090) #8 0x4d0a17 in __lsan::HandleLeaks() (/home/christian/Coding/workspaces/htop/htop+0x4d0a17) #9 0x4cd950 in __lsan::DoLeakCheck() (/home/christian/Coding/workspaces/htop/htop+0x4cd950) #10 0x7f8a110454d6 in __run_exit_handlers stdlib/exit.c:108:8 #11 0x7f8a11045679 in exit stdlib/exit.c:139:3 #12 0x7f8a1102dd10 in __libc_start_main csu/../csu/libc-start.c:342:3 #13 0x428a19 in _start (/home/christian/Coding/workspaces/htop/htop+0x428a19) 0x60d000000080 is located 64 bytes inside of 144-byte region [0x60d000000040,0x60d0000000d0) freed by thread T0 here: #0 0x4a4f72 in free (/home/christian/Coding/workspaces/htop/htop+0x4a4f72) #1 0x566693 in Settings_delete /home/christian/Coding/workspaces/htop/Settings.c:32:4 #2 0x4ede10 in CommandLine_run /home/christian/Coding/workspaces/htop/CommandLine.c:393:4 #3 0x4d6f32 in main /home/christian/Coding/workspaces/htop/htop.c:15:11 #4 0x7f8a1102dd09 in __libc_start_main csu/../csu/libc-start.c:308:16 previously allocated by thread T0 here: #0 0x4a5372 in __interceptor_calloc (/home/christian/Coding/workspaces/htop/htop+0x4a5372) #1 0x57f61a in xCalloc /home/christian/Coding/workspaces/htop/XUtils.c:55:17 #2 0x5688a6 in Settings_new /home/christian/Coding/workspaces/htop/Settings.c:392:21 #3 0x4ecb57 in CommandLine_run /home/christian/Coding/workspaces/htop/CommandLine.c:303:25 #4 0x4d6f32 in main /home/christian/Coding/workspaces/htop/htop.c:15:11 #5 0x7f8a1102dd09 in __libc_start_main csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: heap-use-after-free /home/christian/Coding/workspaces/htop/Settings.c:329:26 in Settings_write
2021-07-07Add a new DynamicMeter class for runtime Meter extensionNathan Scott
This commit is based on exploratory work by Sohaib Mohamed. The end goal is two-fold - to support addition of Meters we build via configuration files for both the PCP platform and for scripts ( https://github.com/htop-dev/htop/issues/526 ) Here, we focus on generic code and the PCP support. A new class DynamicMeter is introduced - it uses the special case 'param' field handling that previously was used only by the CPUMeter, such that every runtime-configured Meter is given a unique identifier. Unlike with the CPUMeter this is used internally only. When reading/writing to htoprc instead of CPU(N) - where N is an integer param (CPU number) - we use the string name for each meter. For example, if we have a configuration for a DynamicMeter for some Redis metrics, we might read and write "Dynamic(redis)". This identifier is subsequently matched (back) up to the configuration file so we're able to re-create arbitrary user configurations. The PCP platform configuration file format is fairly simple. We expand configs from several directories, including the users homedir alongside htoprc (below htop/meters/) and also /etc/pcp/htop/meters. The format will be described via a new pcp-htop(5) man page, but its basically ini-style and each Meter has one or more metric expressions associated, as well as specifications for labels, color and so on via a dot separated notation for individual metrics within the Meter. A few initial sample configuration files are provided below ./pcp/meters that give the general idea. The PCP "derived" metric specification - see pmRegisterDerived(3) - is used as the syntax for specifying metrics in PCP DynamicMeters.
2021-04-14Add read-only optionChristian Göttsche
Add command line option to disable all system and process changing features.
2021-03-31TaskMeter: always show number of threadsChristian Göttsche
Always show the number of kernel and userland threads, even when they are disabled to not be shown in the process list. The data is already available and might improve understanding the system utilization. Use a shadow color in case the kind of thread is hidden, else the normal meter one.
2021-03-15Linux: individually show shared memoryChristian Göttsche
Shmem: Total memory used by shared memory (shmem) and tmpfs Source: https://www.kernel.org/doc/Documentation/filesystems/proc.txt Closes: #556
2021-02-17Refactor to remove no-op callsBenny Baumann
This removes the call-sites of the removed setuid feature
2021-02-17Remove setuid supportBenny Baumann
This support was rarely ever used and has been disabled by default for some time. As far as the developer team is aware there's no distribution that activated this feature in their packages by default.
2021-01-27Pass Settings to CRT_initChristian Göttsche
Resolve todo
2021-01-19Linux: individual huge page values in the huge page meterDavid Zarzycki
2021-01-11Linux: Add SwapCached to the swap meterDavid Zarzycki
According to the Linux kernel documentation, "SwapCached" tracks "memory that once was swapped out, is swapped back in but still also is in the swapfile (if memory is needed it doesn't need to be swapped out AGAIN because it is already in the swapfile. This saves I/O)."
2021-01-07Show arrow indicating order of sorted process columnChristian Göttsche
2020-12-26CRT: add METER_VALUE_ERROR and adjust some METER_VALUE_WARN colorsChristian Göttsche
2020-12-14Misc CRT cleanupChristian Göttsche
2020-12-10Cull the definitions of pageSize and pageSizeKB from CRT.cNathan Scott
By storing the per-process m_resident and m_virt values in the form htop wants to display them in (KB, not pages), we no longer need to have definitions of pageSize and pageSizeKB in the common CRT code. These variables were never really CRT (i.e. display) related in the first place. It turns out the darwin platform code doesn't need to use these at all (the process values are extracted from the kernel in bytes not pages) and the other platforms can each use their own local pagesize variables, in more appropriate locations. Some platforms were actually already doing this, so this change is removing duplication of logic and variables there.
2020-11-25Add support to change numeric options in settings screenChristian Göttsche
Like delay or highlightDelaySecs
2020-11-24Improving Command display/sortNarendran Gopalakrishnan
2020-11-16Show CPU temperature in CPU meterChristian Göttsche
Show the CPU temperature in the CPU meter, like CPU frequency, instead of using an extra Meter.
2020-11-16Merge branch 'hili-new-old' of adsr/htop into highlight-new-old-processesDaniel Lange
2020-11-15Resolve merge conflicts, merge #229 "Add SystemdMeter" from @cgzonesDaniel Lange
2020-11-02Spacing around operatorsBenny Baumann
2020-10-31Add SystemdMeterChristian Göttsche
2020-10-31Zram Meter featureMurloc Knight
2020-10-30Highlight new and old processes (#74)Adam Saponara
2020-10-26Improve handling of no data in Disk and Network IO MetersChristian Göttsche
2020-10-19Cache PAGE_SIZEChristian Göttsche
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-18Make all required includes explicitBenny Baumann
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-16Generalize Meter value colors for IOChristian Göttsche
2020-10-14Misc CRT cleanupChristian Göttsche
2020-10-12Centralise fault handlingBenny Baumann
This should be done as all platforms essentially did the same anyway and there was nothing platform specific.
2020-10-12Add key to pause process list updatesChristian Göttsche
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-03Add DiskIOMeter for IO read/write usageChristian Göttsche
2020-10-02Adjust colorsChristian Göttsche
- do not reverse CPU steal and guest in monochrome - black on black in Light Terminal is not visible, use blue on black - white on blue in Light Terminal is display as blue on black, use yellow on black - re-draw FunctionBar after color change
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-18Avoid checking of undefined macrosChristian Göttsche
These feature macros are either define or not defined at all at the configure step.
2020-09-18Use strict function prototypesChristian Göttsche
int foo(); declares a function taking any number of arguments.
2020-09-18Refactor __attribute__ usageChristian Göttsche
Use internal macros for compatibility with non GNUC compilers.
2020-09-17Enhance highlighting of semi-large and large numbersBenny Baumann
2020-09-17Allow third party sigsegv handlerChristian Göttsche
For example from sanitizers.
2020-09-12Alignment tweakHugo Musso Gualandi
2020-09-12Clean up some code duplication in the header filesHugo Musso Gualandi
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.
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-09-01add option (-U, --no-unicode) to disable unicode at runtimeChristian Hesse
2020-08-31Revert "Use UTF-8 for check buttons and tree open/closed"Bert Wesarg
This reverts commit 5d5913d355b3a9f03da589b3542b8f55467b4ed6.
2020-08-26Merge branch 'ci-hwloc-job' of https://github.com/bertwesarg/htop into ↵Nathan Scott
bertwesarg-ci-hwloc-job