summaryrefslogtreecommitdiffstats
path: root/linux
AgeCommit message (Collapse)Author
6 daysLinux: show newlines in commands as ? instead of spaceChristian Göttsche
Since \n is used internally by htop to split command lines, replace \n with \r in command lines to not display them as space. Merging the command string will not work, but newlines in commands should be rather the exception.
2024-04-26Linux: 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>
2024-04-18Merge branch 'gcc14-analyzer-fixes' of BenBE/htopDaniel Lange
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-17Explicit memory initialization when reading status fileBenny Baumann
2024-04-13linux: harden terminal parsingChristian Göttsche
Handle corrupted data in /proc/tty/drivers, either via injection or buffer truncation.
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-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-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
2024-04-06Linux: reorder some calls in LinuxProcessList_recurseProcTree()Christian Göttsche
Improve maintainability by reordering calls in LinuxProcessList_recurseProcTree() to group them by side-effect or interdependency.
2024-04-06Linux: update gathering information regarding threadsChristian Göttsche
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.
2024-04-06Linux: gather permitted capabilities via capget(2)Christian Göttsche
#1211 has shown reading /proc/<pid>/status might have a significant performance impact. It was started to be read by default to gather the permitted capabilities of the process. Gather permitted capabilities via the syscall capget(2) instead. cap_get_proc(3) is not used to avoid linking with -lcap.
2024-04-05Adapt GPU_TIME field for the new nanoseconds formatExplorer09
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
2024-04-05linux: use dlopen for libnl3 instead of dynamic linkingChristian Göttsche
Instead of the current behavior of dynamic linking against libnl3 and libnl-genl-3 when configured with --enable-delayacct, load the shared libraries on request, if any delay accounting related process field is active, via dlopen(3), similar to libsensors and libsystemd. Distribution, who currently build htop with --enable-delayacct, need to explicitly add libnl3 and libnl-genl-3 as runtime dependencies to continue supporting delay accounting out-of-the-box.
2024-04-05linux: move libnl code into separate fileChristian Göttsche
Move all the code using libnl functionality into a separate file to ease modifications. No functional change.
2024-04-05Use size_t for array indices consistentlyBenny Baumann
This avoids a compiler warning with GCC 14 and LTO claiming uninitialized use of data[i] in the last loop.
2024-03-27Linux: Correctly mark trailing offline CPU threadsMartin Rys
2024-03-27Avoid glibc FILE API for number of open filesBenny Baumann
2024-03-27Avoid glibc FILE API for maxpidBenny Baumann
2024-03-27Avoid glibc FILE API for loadavgBenny Baumann
2024-03-27Avoid glibc FILE API for uptime readingBenny Baumann
2024-03-27Avoid glibc FILE API for secattrBenny Baumann
2024-03-27Avoid glibc FILE API for oom_scoreBenny Baumann
2024-03-27Avoid glibc FILE voodooBenny Baumann
Addresses #1408
2024-03-27Linux: scan GPU based on previous activityChristian Göttsche
Instead of ignoring the standard file descriptors 0, 1 and 2 scan for GPU usage of a process only if that process had activity last cycle or its last scan was more than five seconds ago.
2024-03-27Linux: add GPU meter and process columnChristian Göttsche
Based on the DRM client usage stats[1] add statistics for GPU time spend and percentage utilization. [1]: https://www.kernel.org/doc/html/latest/gpu/drm-usage-stats.html
2024-03-27Introduce autoTitleRightAlign column flagChristian Göttsche
Instead of handling PERCENT_CPU as a special case for whether to align the title of a dynamically sized column to the right or the left introduce a new flag, which can be reused by other columns.
2024-01-27Read executable name before checking the command lineBenny Baumann
This potentially avoids guessing the right path in the presence of spaces inside the executable path.
2024-01-27Properly track if we actually hit any token while scanning cmdlineBenny Baumann
2024-01-25Explicitly check sscanf(3) and fscanf(3) return valuesChristian Göttsche
Compare the return value of sscanf(3) and fscanf(3) explicitly against the expected number of parsed items and avoid implicit boolean conversion. Such an implicit conversion would treat EOF (-1) the same as at least one item parsed successfully. Reported by CodeQL.
2024-01-20Linux: drop preconditions for free_and_xStrdup()Christian Göttsche
free_and_xStrdup() internally skips the strdup() allocation if both strings exist are are the same. Drop such conditions prior of a call.
2024-01-20Linux: rename variable for clearer intentChristian Göttsche
Make it more clear the variable stores the previous tty number (similar to lasttimes), while the current one gets set in the intermediate LinuxProcessTable_readStatFile().
2024-01-12Fix the display of number of running tasksBenny Baumann
This was broken by a logic change in 72235d8e. Fixes: #1369
2024-01-10Fix static linking with libsystemdChristian Göttsche
libsystemd requires libcap for static linking. Add missing macro for function alias.
2024-01-10Linux: use fseek(3)Christian Göttsche
Use fseek(3) instead of rewind(3) to check for success.
2023-12-31Shorten docker container IDs to 12 charactersBenny Baumann
2023-12-26Relocate include of config.h from header to source modeuleBenny Baumann
2023-12-26Update includes based on IWYUBenny Baumann
2023-12-26Use consistent style for process field output/compare functionsBenny Baumann
2023-12-26Fix code styleBenny Baumann
2023-12-26Add includes for config.h as per the discussion in PR #1337Daniel Lange
Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us.
2023-12-11Consolidate duplicate string constants in CGroup filtersBenny Baumann
2023-12-11Add column for process container nameBenny Baumann
2023-12-11Add logic to filter the container name (+type) from the CGroup nameBenny Baumann