summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/linux/Host.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host/linux/Host.cpp')
-rw-r--r--lldb/source/Host/linux/Host.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
new file mode 100644
index 00000000000..b0d43e87de6
--- /dev/null
+++ b/lldb/source/Host/linux/Host.cpp
@@ -0,0 +1,35 @@
+//===-- source/Host/linux/Host.cpp ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+#include <stdio.h>
+#include <sys/utsname.h>
+
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Host/Host.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+bool
+Host::GetOSVersion(uint32_t &major,
+ uint32_t &minor,
+ uint32_t &update)
+{
+ struct utsname un;
+ int status;
+
+ if (uname(&un))
+ return false;
+
+ status = sscanf(un.release, "%u.%u.%u", &major, &minor, &update);
+ return status == 3;
+}
OpenPOWER on IntegriCloud