From 76a13dbb4ea82c0a22c8d3a74476b9446aa91a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 9 Jan 2024 22:55:34 +0100 Subject: Linux: do not always read /proc//status #1211 showed reading /proc//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//status parsing") Improves: #1211 --- linux/LinuxProcessTable.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/linux/LinuxProcessTable.c b/linux/LinuxProcessTable.c index 9139dbe5..64a0fd93 100644 --- a/linux/LinuxProcessTable.c +++ b/linux/LinuxProcessTable.c @@ -1525,8 +1525,15 @@ static bool LinuxProcessTable_recurseProcTree(LinuxProcessTable* this, openat_ar if (!LinuxProcessTable_updateUser(host, proc, procFd, mainTask)) goto errorReadingProcess; - if (!LinuxProcessTable_readStatusFile(proc, procFd)) - goto errorReadingProcess; + if (ss->flags & PROCESS_FLAG_LINUX_CTXT + || hideRunningInContainer +#ifdef HAVE_VSERVER + || ss->flags & PROCESS_FLAG_LINUX_VSERVER +#endif + ) { + if (!LinuxProcessTable_readStatusFile(proc, procFd)) + goto errorReadingProcess; + } if (!preExisting) { -- cgit v1.2.3