CPU (SunOS): supports tempSensor

This commit is contained in:
李通洲
2025-12-11 14:24:07 +08:00
parent cb1f0300b9
commit e766809e3a
+7 -2
View File
@@ -3,10 +3,15 @@
#include "util/stringUtils.h"
#include <kstat.h>
static const char* detectCPUTempByKstat(kstat_ctl_t* kc, FFCPUResult* cpu)
static const char* detectCPUTempByKstat(FFCPUOptions* options, kstat_ctl_t* kc, FFCPUResult* cpu)
{
const char* possibleModules[] = {"temperature", "cpu_temp", "acpi_thermal", NULL};
if (options->tempSensor.length > 0) {
possibleModules[0] = options->tempSensor.chars;
possibleModules[1] = NULL;
}
for (int i = 0; possibleModules[i] != NULL; i++) {
kstat_t* ks = kstat_lookup(kc, possibleModules[i], -1, NULL);
if (ks && kstat_read(kc, ks, NULL) >= 0) {
@@ -141,7 +146,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
if (options->temp)
{
if (detectCPUTempByKstat(kc, cpu) != NULL)
if (detectCPUTempByKstat(options, kc, cpu) != NULL)
detectCPUTempByIpmiTool(cpu);
}