summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2020-12-14 11:27:13 +1100
committerBenBE <BenBE@geshi.org>2020-12-14 01:46:29 +0100
commit8d69a9a53eb05bb04383456dfcd16b507766d1da (patch)
treefe33adaecc774a515adfc3a97271aeada1a2a2ba /linux
parentf8a610e6e170555f78731c3ea976d833a9f9f716 (diff)
Simplify initialization of the Linux haveSmapsRollup variable
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxProcessList.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 1dab5dbb..5298cd3e 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -214,14 +214,8 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
CRT_fatalError("Cannot get pagesize by sysconf(_SC_PAGESIZE)");
pageSizeKB = pageSize / ONE_K;
- // Check for /proc/*/smaps_rollup availability (improves smaps parsing speed, Linux 4.14+)
- FILE* file = fopen(PROCDIR "/self/smaps_rollup", "r");
- if (file != NULL) {
- this->haveSmapsRollup = true;
- fclose(file);
- } else {
- this->haveSmapsRollup = false;
- }
+ // Test /proc/PID/smaps_rollup availability (faster to parse, Linux 4.14+)
+ this->haveSmapsRollup = (access(PROCDIR "/self/smaps_rollup", R_OK) == 0);
// Read btime
{

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