summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dragonflybsd/DragonFlyBSDMachine.c2
-rw-r--r--freebsd/FreeBSDMachine.c2
-rw-r--r--netbsd/NetBSDMachine.c2
-rw-r--r--openbsd/OpenBSDMachine.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/dragonflybsd/DragonFlyBSDMachine.c b/dragonflybsd/DragonFlyBSDMachine.c
index e1da417b..04962d7c 100644
--- a/dragonflybsd/DragonFlyBSDMachine.c
+++ b/dragonflybsd/DragonFlyBSDMachine.c
@@ -105,7 +105,7 @@ Machine* Machine_new(UsersTable* usersTable, uid_t userId) {
}
len = sizeof(this->kernelFScale);
- if (sysctlbyname("kern.fscale", &this->kernelFScale, &len, NULL, 0) == -1) {
+ if (sysctlbyname("kern.fscale", &this->kernelFScale, &len, NULL, 0) == -1 || this->kernelFScale <= 0) {
//sane default for kernel provided CPU percentage scaling, at least on x86 machines, in case this sysctl call failed
this->kernelFScale = 2048;
}
diff --git a/freebsd/FreeBSDMachine.c b/freebsd/FreeBSDMachine.c
index f5d228c8..d781414b 100644
--- a/freebsd/FreeBSDMachine.c
+++ b/freebsd/FreeBSDMachine.c
@@ -136,7 +136,7 @@ Machine* Machine_new(UsersTable* usersTable, uid_t userId) {
}
len = sizeof(this->kernelFScale);
- if (sysctlbyname("kern.fscale", &this->kernelFScale, &len, NULL, 0) == -1) {
+ if (sysctlbyname("kern.fscale", &this->kernelFScale, &len, NULL, 0) == -1 || this->kernelFScale <= 0) {
//sane default for kernel provided CPU percentage scaling, at least on x86 machines, in case this sysctl call failed
this->kernelFScale = 2048;
}
diff --git a/netbsd/NetBSDMachine.c b/netbsd/NetBSDMachine.c
index 9f3b32de..c1e6f7ed 100644
--- a/netbsd/NetBSDMachine.c
+++ b/netbsd/NetBSDMachine.c
@@ -112,7 +112,7 @@ Machine* Machine_new(UsersTable* usersTable, uid_t userId) {
NetBSDMachine_updateCPUcount(this);
size = sizeof(this->fscale);
- if (sysctl(fmib, 2, &this->fscale, &size, NULL, 0) < 0) {
+ if (sysctl(fmib, 2, &this->fscale, &size, NULL, 0) < 0 || this->fscale <= 0) {
CRT_fatalError("fscale sysctl call failed");
}
diff --git a/openbsd/OpenBSDMachine.c b/openbsd/OpenBSDMachine.c
index 177e7d29..8b86dfab 100644
--- a/openbsd/OpenBSDMachine.c
+++ b/openbsd/OpenBSDMachine.c
@@ -99,7 +99,7 @@ Machine* Machine_new(UsersTable* usersTable, uid_t userId) {
OpenBSDProcessList_updateCPUcount(this);
size = sizeof(this->fscale);
- if (sysctl(fmib, 2, &this->fscale, &size, NULL, 0) < 0) {
+ if (sysctl(fmib, 2, &this->fscale, &size, NULL, 0) < 0 || this->fscale <= 0) {
CRT_fatalError("fscale sysctl call failed");
}