| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When parsing an essential pid entry file like 'status' fails, we treat
the process as a short-lived one and skip adding it into the process
table.
This should be done before the process is added, as the goto label used
for error handling can free the process structure, thus causing an
use-after-free scenario.
Fixes: 22d25db46 ("Linux: detect container process by different PID namespace")
Closes: #1455
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Handle corrupted data in /proc/tty/drivers, either via injection or
buffer truncation.
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Percentage column was always broken, time column needs to be adjusted
after recent formatting changes.
|
|
|
|
|
| |
Might be useful for some users and for debugging the
hideRunningInContainer detection.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
#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
|
|
|
|
|
|
| |
Improve maintainability by reordering calls in
LinuxProcessList_recurseProcTree() to group them by side-effect or
interdependency.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
#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.
|
|
|
|
| |
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Move all the code using libnl functionality into a separate file to ease
modifications.
No functional change.
|
|
|
|
| |
This avoids a compiler warning with GCC 14 and LTO claiming uninitialized use of data[i] in the last loop.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Addresses #1408
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This potentially avoids guessing the right path in the presence of spaces inside the executable path.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
free_and_xStrdup() internally skips the strdup() allocation if both
strings exist are are the same. Drop such conditions prior of a call.
|
|
|
|
|
|
| |
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().
|
|
|
|
|
|
| |
This was broken by a logic change in 72235d8e.
Fixes: #1369
|
|
|
|
|
|
| |
libsystemd requires libcap for static linking.
Add missing macro for function alias.
|
|
|
|
| |
Use fseek(3) instead of rewind(3) to check for success.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|