From 0204b2d2bcd33e2e11ef723fe351af9802d48bfb Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Sun, 14 Mar 2021 10:41:16 +0000 Subject: [PATCH] cpu: openbsd. report cpufreq. 0-100% is portable but really useless for userspace thingies like this. --- src/bin/system/machine/cpu.bogox | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/system/machine/cpu.bogox b/src/bin/system/machine/cpu.bogox index e42fd5a..eff7440 100644 --- a/src/bin/system/machine/cpu.bogox +++ b/src/bin/system/machine/cpu.bogox @@ -564,7 +564,10 @@ system_cpu_frequency_min_max_get(int *min, int *max) } #elif defined(__OpenBSD__) + *min = 0; + *max = 100; + return 0; #endif (void) freq_min; (void) freq_max; return -1; @@ -582,7 +585,7 @@ system_cpu_frequency_get(void) #elif defined(__OpenBSD__) int mib[2] = { CTL_HW, HW_CPUSPEED }; size_t len = sizeof(freq); - if (sysctl(mib, sizeof(mib), &freq, &len, NULL, 0) != -1) + if (sysctl(mib, 2, &freq, &len, NULL, 0) != -1) freq *= 1000; #elif defined(__linux__) FILE *f;