summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
8 daysFix GCC build warning in NetBSD 10mainExplorer09
The warning message is "array subscript has type 'char' [-Wchar-subscripts]" Fix this by casting to 'unsigned char' before passing any character to a `<ctype.h>` function. Also add an assertion to RichString_writeFromAscii() to ensure the characters in the string are all in ASCII range. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
8 daysLinux: Permit non-ASCII for CGROUP, CONTAINER & SECATTR fieldsExplorer09
Assume the CGROUP, CCGROUP, CONTAINER and SECATTR field value may contain non-ASCII characters and use RichString_appendWide() to convert the strings. Patch suggested by Christian Göttsche (@cgzones) Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
11 daysFix "CPU usage bar" help alignment.Anton Soroko
12 daysUpdate '__STDC_VERSION__' check with C23Explorer09
`__STDC_VERSION__` will be defined as 202311L for C23.
13 daysdarwin: scan thread informationrobaho
Inspired by: https://github.com/hishamhm/htop/pull/848 Closes: #542
14 daysdarwin: avoid double division by zero on startupChristian Göttsche
2024-04-20Use struct member to determine size of allocationsBenny Baumann
2024-04-20Adjust some code style for maintainabilityExplorer09
2024-04-20MemorySwapMeter_init() code shrinkExplorer09
2024-04-20Define MeterModeId to unsigned int and use it throughoutExplorer09
All uses of meter drawing "mode" numbers now have the type `MeterModeId`, including the uses in structures and arrays. `MeterModeId` is defined as `unsigned int`, as (currently) it doesn't save any code size by defining it to any smaller type. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-20New header "MeterMode.h" for MeterModeId definitionsExplorer09
This is a prerequisite to using MeterModeId type in more headers, to avoid header dependency hell.
2024-04-20Make 'Meter_modes' private and simplify its structureExplorer09
All client codes that access this global `Meter_modes` array have been replaced in previous commits, thus it's no longer necessary to keep this internal information (draw functions, default heights, etc.) public. It was also a bad idea when the client codes need to avoid accessing `Meter_modes[0]` (which is reserved and contains null information) by themselves. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-20Reorder Meter.c sections. No code changes.Explorer09
This section reordering is a prerequisite to privatizing the `Meter_modes` array.
2024-04-20MemorySwapMeter: Read height from sub-meter objectsExplorer09
The Meter objects have their own 'h' properties. Avoid access to the `Meter_modes` array. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-20CPUMeter: Read height from sub-meter objectsExplorer09
The Meter objects have their own 'h' properties. Avoid access to the `Meter_modes` array. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-20Remove CUSTOM_METERMODE MeterModeIdExplorer09
Meter mode ID 0 will now be reserved.
2024-04-20Don't initialize meter mode in custom meter init functionsExplorer09
Let the respective `MeterClass.updateMode` functions initialize the meter mode instead. The `updateMode` function is always called after the `MeterClass.init` function by `Meter_new()`. This not only simplifies the init functions of meter subclasses, but avoids the use of the global `Meter_modes` array when it's unnecessary. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-20Obsolete the CUSTOM_METERMODE use in default modeExplorer09
The use of CUSTOM_METERMODE value in meter default mode was a bad design. There are no meter that really has a "custom" mode to work with and currently that value serves as a useless placeholder that hides the real default mode for a meter. Replace CUSTOM_METERMODE in `defaultMode` of all meters with the real intended default modes. Currently only CPU meters and MemorySwapMeter used this, and their real defaults are BAR_METERMODE. In Meter_setMode(), remove the special treatment of `defaultMode == CUSTOM_METERMODE`, Meter_setMode() still calls the `updateMode` function for custom treatment when it's present for a meter class. As CUSTOM_METERMODE is obsolete from `defaultMode`, the init functions of CPU meters and MemorySwapMeter need to be adjusted to avoid incomplete initialization (Meter.draw function bring NULL). Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-18Merge branch 'gcc14-analyzer-fixes' of BenBE/htopDaniel Lange
2024-04-18Avoid magic numbers for the size of FunctionBar listsBenny Baumann
2024-04-17Use 'sb' name for local 'struct stat' buffersExplorer09
Deprecate the use of 'st' and other names. The 'sb' name is often seen in example codes in Linux man pages. (The 'statbuf' name is sometimes also used but I choose 'sb' name because it's shorter.) No code changes.
2024-04-17Use 'fp' name for local 'FILE*' variables.Explorer09
It is inappropriate to use the 'fd' name for 'FILE*' variables. POSIX file descriptiors are of type 'int' and are distinguished from ISO C stream pointers (type 'FILE*'). Rename these variables to 'fp', which is a preferred naming in POSIX. (Note that ISO C preferred the 'stream' name for the variables.) No code changes.
2024-04-17Reserve full function array to make the GCC14 static code analyzer happyBenny Baumann
Only happens with LTO, -fanalyzer, and -fsanitize=address,leak
2024-04-17Explicit memory initialization when reading status fileBenny Baumann
2024-04-17Merge branch 'add-git-commit-to-compiled-dev-versions' of fasterit/htopDaniel Lange
2024-04-17Merge branch 'hf-one-100' of peterdey/htopDaniel Lange
2024-04-17Merge branch 'signal_safe' of cgzones/htopDaniel Lange
2024-04-17Merge branch 'htoprc-write-check' of Explorer09/htop-1Daniel Lange
2024-04-17Add HeaderLayout format for one single 100%-width columnPeter Dey
2024-04-17Avoid writing configuration to non-regular filesExplorer09
Check whether the configuration file (after symlink resolution) is writable and is a regular file on htop startup, and only then, write the configuration on exit. Also permit reading when the legacy configuration file ("~/.htoprc") is a symlink. Write the new configuration only when both the legacy file and the new location are writable. Thanks to Christian Göttsche (@cgzones) for providing the initial version of the patch. Fixes: #1426 Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-16Memory leak when a legacy config file existsBenny Baumann
Fixes regression caused by 15b4bc45b2b0ccf2 Fixes: #1449 Co-authored-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-16Update configure.ac with some m4 magic to add a git commit idDaniel Lange
and a reference of the last tag, the changes since then and the dirty flag from `git describe`
2024-04-15CI: (OpenBSD) Detect latest Autoconf & Automake versionsExplorer09
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-15CI: Remove Autoconf version num (FreeBSD & DragonFlyBSD)Explorer09
Recently FreeBSD updated its Autoconf package to 2.72 and removed the old Autoconf-2.71 package. This caused build error in our CI jobs. Remove the Autoconf version number from FreeBSD and DragonFlyBSD jobs. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-13Avoid fprintf in Settings_writeChristian Göttsche
Settings_write() is called on a crash inside of a signal handler. Using fprintf(3) is not safe to call ins signal handlers due to file buffering and memory allocations. Format messages in signal handlers via snprintf(3) and output them via write(2) on crash.
2024-04-13Avoid fprintf in signal handlersChristian Göttsche
fprintf(3) is not safe to call ins signal handlers due to file buffering and memory allocations. Format messages in signal handlers via snprintf(3) and output them via write(2).
2024-04-13linux: harden terminal parsingChristian Göttsche
Handle corrupted data in /proc/tty/drivers, either via injection or buffer truncation.
2024-04-13BarMeterMode_draw() code formatting adjustmentExplorer09
Suggested by Benny Baumann (@BenBE). No code changes.
2024-04-08Work around GCC14 memleak diagnosticBenny Baumann
While both pointers are identical, GCC-14 with -fanalyzer complains about these return statements to leak memory. The leak is only reported with LTO though.
2024-04-08Align parameter names in declarations with definitionsChristian Göttsche
2024-04-08Drop return at end of function returning voidChristian Göttsche
2024-04-08Use uppercase floating point literalsChristian Göttsche
2024-04-08Drop casts to same typeChristian Göttsche
2024-04-08Linux: fix title alignments of GPU columnsChristian Göttsche
Percentage column was always broken, time column needs to be adjusted after recent formatting changes.
2024-04-08Row_printNanoseconds fixesChristian Göttsche
Don't print twice for 0.9s. Don't truncate on 1.2s, leading to an abort.
2024-04-07Merge branch 'richstring-buffer-realloc' of BenBE/htopDaniel Lange
2024-04-07Properly handle RichString_extendLen when an external buffer already existsBenny Baumann
2024-04-06Linux: add process column whether it is marked a container processChristian Göttsche
Might be useful for some users and for debugging the hideRunningInContainer detection.
2024-04-06Linux: detect container process by different PID namespaceChristian Göttsche
Container engines like docker and podman rely on Linux namespaces. If available check if the target process is inside a different PID namespace than htop. This check will mark sandbox'ed applications, e.g. under bubblewrap, but not light-wight containers, like distrobox.
2024-04-06Linux: do not always read /proc/<pid>/statusChristian Göttsche
#1211 showed reading /proc/<pid>/status might have a significant performance impact. Do not read by default only if actually needed, since the permitted capabilities are no longer gather from it. Improves: 8ea144df ("Linux: Refactor /proc/<pid>/status parsing") Improves: #1211