forked from OSchip/llvm-project
Add Linux support for HostInfo::GetOSBuildString and HostInfo::GetOSKernelDescription.
llvm-svn: 223737
This commit is contained in:
parent
6a2fabcc3f
commit
53c038a581
|
@ -34,6 +34,8 @@ class HostInfoLinux : public HostInfoPosix
|
|||
static uint32_t GetMaxThreadNameLength();
|
||||
|
||||
static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
|
||||
static bool GetOSBuildString(std::string &s);
|
||||
static bool GetOSKernelDescription(std::string &s);
|
||||
static llvm::StringRef GetDistributionId();
|
||||
static FileSpec GetProgramFileSpec();
|
||||
|
||||
|
|
|
@ -88,6 +88,35 @@ finished:
|
|||
return success;
|
||||
}
|
||||
|
||||
bool
|
||||
HostInfoLinux::GetOSBuildString(std::string &s)
|
||||
{
|
||||
struct utsname un;
|
||||
::memset(&un, 0, sizeof(utsname));
|
||||
s.clear();
|
||||
|
||||
if (uname(&un) < 0)
|
||||
return false;
|
||||
|
||||
s.assign(un.release);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
HostInfoLinux::GetOSKernelDescription(std::string &s)
|
||||
{
|
||||
struct utsname un;
|
||||
|
||||
::memset(&un, 0, sizeof(utsname));
|
||||
s.clear();
|
||||
|
||||
if (uname(&un) < 0)
|
||||
return false;
|
||||
|
||||
s.assign(un.version);
|
||||
return true;
|
||||
}
|
||||
|
||||
llvm::StringRef
|
||||
HostInfoLinux::GetDistributionId()
|
||||
{
|
||||
|
|
|
@ -1274,7 +1274,6 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
|
|||
}
|
||||
|
||||
std::string s;
|
||||
#if !defined(__linux__)
|
||||
if (HostInfo::GetOSBuildString(s))
|
||||
{
|
||||
response.PutCString ("os_build:");
|
||||
|
@ -1287,7 +1286,6 @@ GDBRemoteCommunicationServer::Handle_qHostInfo (StringExtractorGDBRemote &packet
|
|||
response.PutCStringAsRawHex8(s.c_str());
|
||||
response.PutChar(';');
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
|
|
Loading…
Reference in New Issue