cpu: openbsd. report cpufreq.

0-100% is portable but really useless for userspace thingies like
this.
This commit is contained in:
Alastair Poole 2021-03-14 10:41:16 +00:00
parent 2fc0bc1864
commit 0204b2d2bc
1 changed files with 4 additions and 1 deletions

View File

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