AuroraRuntime/Source/HWInfo/HWInfo.cpp
2021-09-13 21:11:12 +01:00

42 lines
803 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: HWInfo.hpp
Date: 2021-6-19
Author: Reece
***/
#include <RuntimeInternal.hpp>
#include "HWInfo.hpp"
#include "CpuInfo.hpp"
#include "RamInfo.hpp"
#if defined(AURORA_IS_BSD_DERIVED)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
namespace Aurora::HWInfo
{
AuOptional<AuUInt> QueryBsdHwStat(int id)
{
#if defined(AURORA_IS_BSD_DERIVED)
int mib[4];
AuUInt stat;
size_t len = sizeof(stat);
mib[0] = CTL_HW;
mib[1] = id;
auto ret = sysctl(mib, 2, &stat, &len, NULL, 0);
return ret == 0 ? stat : {};
#else
return {};
#endif
}
void Init()
{
InitCpuInfo();
InitRamInfo();
}
}