[Lldb-commits] [lldb] [lldb][AIX] HostInfoAIX Support (PR #117906)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 3 03:12:06 PST 2025
================
@@ -0,0 +1,154 @@
+//===-- HostInfoAIX.cpp -------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/aix/HostInfoAIX.h"
+#include "lldb/Host/Config.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+
+#include "llvm/Support/Threading.h"
+
+#include <climits>
+#include <cstdio>
+#include <cstring>
+#include <sys/utsname.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <mutex>
+
+using namespace lldb_private;
+
+namespace {
+struct HostInfoAIXFields {
+ llvm::once_flag m_distribution_once_flag;
+ std::string m_distribution_id;
+};
+} // namespace
+
+static HostInfoAIXFields *g_fields = nullptr;
+
+void HostInfoAIX::Initialize(SharedLibraryDirectoryHelper *helper) {
+ HostInfoPosix::Initialize(helper);
+
+ g_fields = new HostInfoAIXFields();
+}
+
+void HostInfoAIX::Terminate() {
+ assert(g_fields && "Missing call to Initialize?");
+ delete g_fields;
+ g_fields = nullptr;
+ HostInfoBase::Terminate();
+}
+
+llvm::StringRef HostInfoAIX::GetDistributionId() {
----------------
DavidSpickett wrote:
What would a distribution mean in the context of AIX? MacOS for example doesn't return anything for this, I presume because every Mac OS is just Apple's Mac OS. Whereas a Linux can come from many vendors.
So if IBM is the only AIX vendor then this function can be deleted.
```
/// Returns the distribution id of the host
///
/// This will be something like "ubuntu", "fedora", etc. on Linux.
///
/// \return Returns either std::nullopt or a reference to a const std::string
/// containing the distribution id
static llvm::StringRef GetDistributionId() { return llvm::StringRef(); }
```
In any case, I don't think it's too important. Probably shown to the user at some point but nothing seems to make decisions from it.
https://github.com/llvm/llvm-project/pull/117906
More information about the lldb-commits
mailing list