mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Move "get max pid" code into platform specific area.
This commit is contained in:
@ -93,3 +93,12 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
||||
}
|
||||
}
|
||||
|
||||
int Platform_getMaxPid() {
|
||||
FILE* file = fopen(PROCDIR "/sys/kernel/pid_max", "r");
|
||||
if (!file) return -1;
|
||||
int maxPid = 4194303;
|
||||
fscanf(file, "%32d", &maxPid);
|
||||
fclose(file);
|
||||
return maxPid;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user