"get max pid" for FreeBSD

This commit is contained in:
Hisham Muhammad 2014-11-27 20:18:01 -02:00
parent da0956d1cd
commit f4c49ff92e
2 changed files with 12 additions and 0 deletions

View File

@ -83,3 +83,13 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
*five = (double) loadAverage.ldavg[1] / loadAverage.fscale;
*fifteen = (double) loadAverage.ldavg[2] / loadAverage.fscale;
}
int Platform_getMaxPid() {
int maxPid;
size_t size = sizeof(maxPid);
int err = sysctlbyname("kern.pid_max", &maxPid, &size, NULL, 0);
if (err) {
return 99999;
}
return maxPid;
}

View File

@ -19,4 +19,6 @@ int Platform_getUptime();
void Platform_getLoadAverage(double* one, double* five, double* fifteen);
int Platform_getMaxPid();
#endif