mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-23 17:57:54 +02:00
parent
a65f2d6b41
commit
d09add3b86
@ -5,6 +5,7 @@
|
|||||||
#include "base/convert.hpp"
|
#include "base/convert.hpp"
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/defer.hpp"
|
#include "base/defer.hpp"
|
||||||
|
#include "base/lazy-init.hpp"
|
||||||
#include "base/logger.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/socket.hpp"
|
#include "base/socket.hpp"
|
||||||
@ -1691,17 +1692,20 @@ static bool ReleaseHelper(String *platformName, String *platformVersion)
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
String Utility::GetPlatformKernel()
|
static LazyInit<String> l_PlatformKernel ([]() -> String {
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return "Windows";
|
return "Windows";
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
return UnameHelper('s');
|
return UnameHelper('s');
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
});
|
||||||
|
|
||||||
|
String Utility::GetPlatformKernel()
|
||||||
|
{
|
||||||
|
return l_PlatformKernel.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
String Utility::GetPlatformKernelVersion()
|
static LazyInit<String> l_PlatformKernelVersion ([]() -> String {
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
OSVERSIONINFO info;
|
OSVERSIONINFO info;
|
||||||
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
@ -1714,26 +1718,38 @@ String Utility::GetPlatformKernelVersion()
|
|||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
return UnameHelper('r');
|
return UnameHelper('r');
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
});
|
||||||
|
|
||||||
|
String Utility::GetPlatformKernelVersion()
|
||||||
|
{
|
||||||
|
return l_PlatformKernelVersion.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
String Utility::GetPlatformName()
|
static LazyInit<String> l_PlatformName ([]() -> String {
|
||||||
{
|
|
||||||
String platformName;
|
String platformName;
|
||||||
if (!ReleaseHelper(&platformName, nullptr))
|
if (!ReleaseHelper(&platformName, nullptr))
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
return platformName;
|
return platformName;
|
||||||
|
});
|
||||||
|
|
||||||
|
String Utility::GetPlatformName()
|
||||||
|
{
|
||||||
|
return l_PlatformName.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
String Utility::GetPlatformVersion()
|
static LazyInit<String> l_PlatformVersion ([]() -> String {
|
||||||
{
|
|
||||||
String platformVersion;
|
String platformVersion;
|
||||||
if (!ReleaseHelper(nullptr, &platformVersion))
|
if (!ReleaseHelper(nullptr, &platformVersion))
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
return platformVersion;
|
return platformVersion;
|
||||||
|
});
|
||||||
|
|
||||||
|
String Utility::GetPlatformVersion()
|
||||||
|
{
|
||||||
|
return l_PlatformVersion.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
String Utility::GetPlatformArchitecture()
|
static LazyInit<String> l_PlatformArchitecture ([]() -> String {
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SYSTEM_INFO info;
|
SYSTEM_INFO info;
|
||||||
GetNativeSystemInfo(&info);
|
GetNativeSystemInfo(&info);
|
||||||
@ -1750,6 +1766,11 @@ String Utility::GetPlatformArchitecture()
|
|||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
return UnameHelper('m');
|
return UnameHelper('m');
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
});
|
||||||
|
|
||||||
|
String Utility::GetPlatformArchitecture()
|
||||||
|
{
|
||||||
|
return l_PlatformArchitecture.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char l_Utf8Replacement[] = "\xEF\xBF\xBD";
|
const char l_Utf8Replacement[] = "\xEF\xBF\xBD";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user