summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix "CPU usage bar" help alignment.mainAnton Soroko2 days1-1/+1
|
* Update '__STDC_VERSION__' check with C23Explorer093 days1-3/+2
| | | | `__STDC_VERSION__` will be defined as 202311L for C23.
* darwin: scan thread informationrobaho4 days3-33/+99
| | | | | | Inspired by: https://github.com/hishamhm/htop/pull/848 Closes: #542
* darwin: avoid double division by zero on startupChristian Göttsche5 days1-6/+12
|
* Use struct member to determine size of allocationsBenny Baumann5 days2-4/+4
|
* Adjust some code style for maintainabilityExplorer095 days1-2/+2
|
* MemorySwapMeter_init() code shrinkExplorer095 days1-3/+1
|
* Define MeterModeId to unsigned int and use it throughoutExplorer095 days9-21/+24
| | | | | | | | | 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>
* New header "MeterMode.h" for MeterModeId definitionsExplorer095 days3-9/+22
| | | | | This is a prerequisite to using MeterModeId type in more headers, to avoid header dependency hell.
* Make 'Meter_modes' private and simplify its structureExplorer095 days2-41/+34
| | | | | | | | | | | 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>
* Reorder Meter.c sections. No code changes.Explorer095 days1-123/+127
| | | | | This section reordering is a prerequisite to privatizing the `Meter_modes` array.
* MemorySwapMeter: Read height from sub-meter objectsExplorer095 days1-1/+1
| | | | | | | The Meter objects have their own 'h' properties. Avoid access to the `Meter_modes` array. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* CPUMeter: Read height from sub-meter objectsExplorer095 days1-1/+3
| | | | | | | The Meter objects have their own 'h' properties. Avoid access to the `Meter_modes` array. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Remove CUSTOM_METERMODE MeterModeIdExplorer095 days1-2/+2
| | | | Meter mode ID 0 will now be reserved.
* Don't initialize meter mode in custom meter init functionsExplorer095 days2-45/+16
| | | | | | | | | | | 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>
* Obsolete the CUSTOM_METERMODE use in default modeExplorer095 days4-20/+22
| | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'gcc14-analyzer-fixes' of BenBE/htopDaniel Lange7 days3-8/+10
|\
| * Avoid magic numbers for the size of FunctionBar listsBenny Baumann7 days2-7/+9
| |
| * Reserve full function array to make the GCC14 static code analyzer happyBenny Baumann8 days1-1/+1
| | | | | | | | Only happens with LTO, -fanalyzer, and -fsanitize=address,leak
| * Explicit memory initialization when reading status fileBenny Baumann8 days1-1/+1
| |
* | Use 'sb' name for local 'struct stat' buffersExplorer098 days3-19/+19
| | | | | | | | | | | | | | | | 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.
* | Use 'fp' name for local 'FILE*' variables.Explorer098 days8-87/+87
|/ | | | | | | | | | | 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.
* Merge branch 'add-git-commit-to-compiled-dev-versions' of fasterit/htopDaniel Lange8 days1-1/+9
|\
| * Update configure.ac with some m4 magic to add a git commit idDaniel Lange9 days1-1/+9
| | | | | | | | | | and a reference of the last tag, the changes since then and the dirty flag from `git describe`
* | Merge branch 'hf-one-100' of peterdey/htopDaniel Lange8 days1-0/+2
|\ \
| * | Add HeaderLayout format for one single 100%-width columnPeter Dey8 days1-0/+2
| |/
* | Merge branch 'signal_safe' of cgzones/htopDaniel Lange8 days3-47/+87
|\ \
| * | Avoid fprintf in Settings_writeChristian Göttsche12 days1-29/+53
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Avoid fprintf in signal handlersChristian Göttsche12 days2-18/+34
| | | | | | | | | | | | | | | | | | | | | 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).
* | | Merge branch 'htoprc-write-check' of Explorer09/htop-1Daniel Lange8 days2-16/+51
|\ \ \
| * | | Avoid writing configuration to non-regular filesExplorer099 days2-16/+51
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | / Memory leak when a legacy config file existsBenny Baumann9 days1-2/+5
| |/ |/| | | | | | | | | | | Fixes regression caused by 15b4bc45b2b0ccf2 Fixes: #1449 Co-authored-by: Kang-Che Sung <explorer09@gmail.com>
* | CI: (OpenBSD) Detect latest Autoconf & Automake versionsExplorer0910 days1-3/+15
| | | | | | | | Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* | CI: Remove Autoconf version num (FreeBSD & DragonFlyBSD)Explorer0910 days1-2/+2
|/ | | | | | | | | 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>
* linux: harden terminal parsingChristian Göttsche12 days1-9/+33
| | | | | Handle corrupted data in /proc/tty/drivers, either via injection or buffer truncation.
* BarMeterMode_draw() code formatting adjustmentExplorer0912 days1-1/+7
| | | | Suggested by Benny Baumann (@BenBE). No code changes.
* Work around GCC14 memleak diagnosticBenny Baumann2024-04-088-8/+8
| | | | | 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.
* Align parameter names in declarations with definitionsChristian Göttsche2024-04-084-5/+5
|
* Drop return at end of function returning voidChristian Göttsche2024-04-081-1/+0
|
* Use uppercase floating point literalsChristian Göttsche2024-04-082-4/+4
|
* Drop casts to same typeChristian Göttsche2024-04-081-4/+4
|
* Linux: fix title alignments of GPU columnsChristian Göttsche2024-04-081-2/+2
| | | | | Percentage column was always broken, time column needs to be adjusted after recent formatting changes.
* Row_printNanoseconds fixesChristian Göttsche2024-04-081-1/+2
| | | | | | Don't print twice for 0.9s. Don't truncate on 1.2s, leading to an abort.
* Merge branch 'richstring-buffer-realloc' of BenBE/htopDaniel Lange2024-04-071-4/+12
|\
| * Properly handle RichString_extendLen when an external buffer already existsBenny Baumann2024-04-071-4/+12
|/
* Linux: add process column whether it is marked a container processChristian Göttsche2024-04-064-1/+19
| | | | | Might be useful for some users and for debugging the hideRunningInContainer detection.
* Linux: detect container process by different PID namespaceChristian Göttsche2024-04-062-14/+46
| | | | | | | 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.
* Linux: do not always read /proc/<pid>/statusChristian Göttsche2024-04-061-2/+9
| | | | | | | | | #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
* Linux: reorder some calls in LinuxProcessList_recurseProcTree()Christian Göttsche2024-04-061-26/+34
| | | | | | Improve maintainability by reordering calls in LinuxProcessList_recurseProcTree() to group them by side-effect or interdependency.
* Linux: update gathering information regarding threadsChristian Göttsche2024-04-064-39/+156
| | | | | | | | | Document for each block gathering information about a task whether the information is shared for the whole process or specific to a single userland thread. Also avoid system calls for process-shared information and reuse the information from the main task.

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