[Lldb-commits] [lldb] [lldb][Linux] Moving APIs from HostInfoLinux to HostInfoPosix (PR #119694)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 13 07:12:35 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.
----------------
DavidSpickett wrote:
Other kernels are probably quirky too, but we know this referred to Linux originally.
https://github.com/llvm/llvm-project/pull/119694
More information about the lldb-commits
mailing list