From 9e317872810d56e7371009f877d59c50c113b857 Mon Sep 17 00:00:00 2001
From: Rolf Eike Beer <eike@sf-mail.de>
Date: Sat, 5 Jan 2013 15:40:37 +0100
Subject: [PATCH] SystemInformation: split AIX code out of QueryMemory()

Change-Id: Icbc836cb189658c0f03b29e3316260c17a3858c1
---
 SystemInformation.cxx | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 70cf630..6087a5e 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -473,6 +473,9 @@ protected:
   //For Microsoft Windows
   bool QueryWindowsMemory();
 
+  //For AIX
+  bool QueryAIXMemory();
+
   bool QueryProcessor();
 
   // Evaluate the memory information.
@@ -1318,6 +1321,8 @@ void SystemInformationImplementation::RunMemoryCheck()
   this->QueryHPUXMemory();
 #elif defined(__linux)
   this->QueryLinuxMemory();
+#elif defined(_AIX)
+  this->QueryAIXMemory();
 #else
   this->QueryMemory();
 #endif
@@ -3512,6 +3517,23 @@ bool SystemInformationImplementation::QueryLinuxMemory()
 #endif
 }
 
+bool SystemInformationImplementation::QueryAIXMemory()
+{
+#if defined(_AIX)
+  long c = sysconf(_SC_AIX_REALMEM);
+  if (c <= 0)
+    {
+    return false;
+    }
+
+  this->TotalPhysicalMemory = c / 1024;
+
+  return true;
+#else
+  return false;
+#endif
+}
+
 /** Query for the memory status */
 int SystemInformationImplementation::QueryMemory()
 {
@@ -3529,16 +3551,6 @@ int SystemInformationImplementation::QueryMemory()
     return false;
     }
   this->TotalPhysicalMemory = m >> 8;
-  return 1;
-#elif defined(_AIX)
-  long c = sysconf(_SC_AIX_REALMEM);
-  if (c <= 0)
-  {
-    return 0;
-  }
-
-  this->TotalPhysicalMemory = c / 1024;
-
   return 1;
 #else
 
-- 
GitLab