[v0.98] Fix compilation in different platforms

This commit is contained in:
Dr-Noob
2021-08-04 23:33:20 +02:00
parent 051a37862c
commit c4f6ba7c55
3 changed files with 11 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
#include "../common/global.h"
#include "udev.h"
#include "midr.h"

View File

@@ -2,6 +2,7 @@
#define __GLOBAL__
#include <stdbool.h>
#include <stddef.h>
void set_log_level(bool verbose);
void printWarn(const char *fmt, ...);

View File

@@ -671,13 +671,16 @@ struct frequency* get_frequency_info(struct cpuInfo* cpu) {
freq->base = UNKNOWN_FREQ;
}
if(freq->max == 0) {
printWarn("Read max CPU frequency from CPUID and got 0 MHz. Using udev");
printWarn("Read max CPU frequency from CPUID and got 0 MHz");
#ifdef __linux__
printWarn("Using udev to detect frequency");
freq->max = get_max_freq_from_file(0, cpu->hv->present);
if(freq->max == 0) {
printWarn("Read max CPU frequency from udev and got 0 MHz");
freq->max = UNKNOWN_FREQ;
}
#endif
}
}