Move "get max pid" code into platform specific area.

This commit is contained in:
Hisham Muhammad
2014-11-27 20:10:23 -02:00
parent 5578a316f0
commit b4f6b11092
5 changed files with 19 additions and 8 deletions

View File

@ -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;
}