Skip to content

Commit 0c90941

Browse files
committed
Chore: remove temps_bsd
1 parent 29ae56e commit 0c90941

File tree

4 files changed

+24
-32
lines changed

4 files changed

+24
-32
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,6 @@ elseif(FreeBSD)
623623
src/detection/gtk_qt/qt.c
624624
src/detection/sound/sound_bsd.c
625625
src/detection/swap/swap_bsd.c
626-
src/detection/temps/temps_bsd.c
627626
src/detection/terminalfont/terminalfont_linux.c
628627
src/detection/terminalshell/terminalshell_linux.c
629628
src/detection/terminalsize/terminalsize_linux.c

src/detection/cpu/cpu_bsd.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
#include "cpu.h"
22
#include "common/sysctl.h"
3-
#include "detection/temps/temps_bsd.h"
3+
4+
static const char* detectCpuTemp(double* current)
5+
{
6+
int temp = ffSysctlGetInt("dev.cpu.0.temperature", -999999);
7+
if (temp == -999999)
8+
return "ffSysctlGetInt(\"dev.cpu.0.temperature\") failed";
9+
10+
// In tenth of degrees Kelvin
11+
*current = (double) temp / 10 - 273.15;
12+
return NULL;
13+
}
14+
15+
static const char* detectThermalTemp(double* current)
16+
{
17+
int temp = ffSysctlGetInt("hw.acpi.thermal.tz0.temperature", -999999);
18+
if (temp == -999999)
19+
return "ffSysctlGetInt(\"hw.acpi.thermal.tz0.temperature\") failed";
20+
21+
// In tenth of degrees Kelvin
22+
*current = (double) temp / 10 - 273.15;
23+
return NULL;
24+
}
425

526
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
627
{
@@ -46,8 +67,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
4667

4768
if (options->temp)
4869
{
49-
if (ffDetectCpuTemp(&cpu->temperature) != NULL)
50-
ffDetectThermalTemp(&cpu->temperature);
70+
if (detectCpuTemp(&cpu->temperature) != NULL)
71+
detectThermalTemp(&cpu->temperature);
5172
}
5273

5374
return NULL;

src/detection/temps/temps_bsd.c

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/detection/temps/temps_bsd.h

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)