[Lldb-commits] [lldb] [lldb][Linux] Moving APIs from HostInfoLinux to HostInfoPosix (PR #119694)
Dhruv Srivastava via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 19 01:02:47 PST 2024
================
@@ -27,6 +30,31 @@
using namespace lldb_private;
+namespace {
+struct HostInfoPosixFields {
+ llvm::once_flag m_os_version_once_flag;
+ llvm::VersionTuple m_os_version;
+};
+} // namespace
+
+llvm::VersionTuple HostInfoPosix::GetOSVersion() {
+ static HostInfoPosixFields *g_fields = new HostInfoPosixFields();
+ assert(g_fields && "Missing call to Initialize?");
+ llvm::call_once(g_fields->m_os_version_once_flag, []() {
+ struct utsname un;
+ if (uname(&un) != 0)
+ return;
+
+ llvm::StringRef release = un.release;
+ // The kernel release string can include a lot of stuff (e.g.
----------------
DhruvSrivastavaX wrote:
Yes, done.
https://github.com/llvm/llvm-project/pull/119694
More information about the lldb-commits
mailing list