From f1d283e941680a97d74a2fb7f6bcdd9490efc394 Mon Sep 17 00:00:00 2001 From: nancy.liao <huihui.liao@greentest.com.cn> Date: 周四, 29 5月 2025 18:14:27 +0800 Subject: [PATCH] 根据具体需求 修改了一个强制性的版本匹配,否则license返回结果不正确 --- src/library/os/cpu_info.hpp | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/library/os/cpu_info.hpp b/src/library/os/cpu_info.hpp index 04da89b..c837493 100644 --- a/src/library/os/cpu_info.hpp +++ b/src/library/os/cpu_info.hpp @@ -9,16 +9,15 @@ #define SRC_LIBRARY_OS_CPU_INFO_H_ #include <string> namespace license { - -typedef enum { BARE_TO_METAL, VMWARE, VIRTUALBOX, V_XEN, KVM, HV, V_OTHER } VIRTUALIZATION_DETAIL; +namespace os { /** * Cpu informations */ class CpuInfo { private: - bool is_hypervisor_set() const; - + const std::string m_vendor; + const std::string m_brand; public: CpuInfo(); virtual ~CpuInfo(); @@ -26,12 +25,12 @@ * Detect Virtual machine using hypervisor bit or the cpu vendor name. * @return true if the cpu is detected to be a virtual cpu */ - bool cpu_virtual() const; uint32_t model() const; - std::string vendor() const; - VIRTUALIZATION_DETAIL getVirtualizationDetail() const; + bool is_hypervisor_set() const; + const std::string& vendor() const { return m_vendor; } + const std::string& brand() const { return m_brand; } }; -} /* namespace license */ - +} // namespace os +} // namespace license #endif /* SRC_LIBRARY_OS_CPU_INFO_H_ */ -- Gitblit v1.9.1