From e766809e3a746c70d27a2a609d8547d4170aae6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 11 Dec 2025 14:24:07 +0800 Subject: [PATCH] CPU (SunOS): supports `tempSensor` --- src/detection/cpu/cpu_sunos.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/detection/cpu/cpu_sunos.c b/src/detection/cpu/cpu_sunos.c index 3185919b9..4d0a887cc 100644 --- a/src/detection/cpu/cpu_sunos.c +++ b/src/detection/cpu/cpu_sunos.c @@ -3,10 +3,15 @@ #include "util/stringUtils.h" #include -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); }