summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcessList.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-06-12 15:19:22 +0200
committerBenBE <BenBE@geshi.org>2021-06-12 16:02:23 +0200
commit45ab05c56af8c57c6f357d4de0926d29b188c348 (patch)
tree21338e31a4032e82a37182a487fc87584ba18731 /linux/LinuxProcessList.c
parent7a8a6dd82880fd0e5ebb9014c3e6d54c569d5b44 (diff)
Limit deleted library check
Reading and parsing /proc/<pid>/maps is quite expensive. Do not check for deleted libraries if the main binary has been deleted; in this case the deleted binary takes precedence. Do not check in threads. The check is void for kernel threads and user- land threads can just inherit the state from the main process structure.
Diffstat (limited to 'linux/LinuxProcessList.c')
-rw-r--r--linux/LinuxProcessList.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 168c7eb7..8500ffa6 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -1354,7 +1354,8 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
{
bool prev = proc->usesDeletedLib;
- if ((lp->m_lrs == 0 && (settings->flags & PROCESS_FLAG_LINUX_LRS_FIX)) || settings->highlightDeletedExe) {
+ if ((lp->m_lrs == 0 && (settings->flags & PROCESS_FLAG_LINUX_LRS_FIX)) ||
+ (settings->highlightDeletedExe && !proc->procExeDeleted && !proc->isKernelThread && !proc->isUserlandThread)) {
// Check if we really should recalculate the M_LRS value for this process
uint64_t passedTimeInMs = pl->realtimeMs - lp->last_mlrs_calctime;
@@ -1365,8 +1366,8 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
LinuxProcessList_readMaps(lp, procFd, settings->flags & PROCESS_FLAG_LINUX_LRS_FIX, settings->highlightDeletedExe);
}
} else {
- /* reset if setting got disabled */
- proc->usesDeletedLib = false;
+ /* Copy from process structure in threads and reset if setting got disabled */
+ proc->usesDeletedLib = (proc->isUserlandThread && parent) ? parent->usesDeletedLib : false;
}
proc->mergedCommand.exeChanged |= prev ^ proc->usesDeletedLib;

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