From e047dbe884f5288943d5ba2f8843a078d647d7ef Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周六, 25 4月 2020 21:01:33 +0800 Subject: [PATCH] first docker & vm detection --- src/library/os/cpu_info.hpp | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/library/os/cpu_info.hpp b/src/library/os/cpu_info.hpp index e0ec59f..c837493 100644 --- a/src/library/os/cpu_info.hpp +++ b/src/library/os/cpu_info.hpp @@ -10,15 +10,14 @@ #include <string> namespace license { namespace os { -typedef enum { BARE_TO_METAL, VMWARE, VIRTUALBOX, V_XEN, KVM, HV, V_OTHER } VIRTUALIZATION_DETAIL; /** * 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,11 +25,10 @@ * 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; - // std::string brand() 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 os -- Gitblit v1.9.1