mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Simplify initialization of the Linux haveSmapsRollup variable
This commit is contained in:
parent
f8a610e6e1
commit
8d69a9a53e
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user