summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2001-08-09 02:56:56 +0000
committerJeremy Katz <katzj@redhat.com>2001-08-09 02:56:56 +0000
commitff26e191f4e6fbbef291211e5746ea2de077fe5d (patch)
treeae1f14a47b47e13de16e3edcec55440174cc8b03 /iutil.py
parente56a3730f68c003a52e16600feee47a90fba6b07 (diff)
downloadanaconda-ff26e191f4e6fbbef291211e5746ea2de077fe5d.tar.gz
anaconda-ff26e191f4e6fbbef291211e5746ea2de077fe5d.tar.xz
anaconda-ff26e191f4e6fbbef291211e5746ea2de077fe5d.zip
use e820 to find out memory info if possible (51210)
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/iutil.py b/iutil.py
index af03b366c..0b37dc435 100644
--- a/iutil.py
+++ b/iutil.py
@@ -188,15 +188,24 @@ def copyFile(source, to, pw = None):
def memInstalled(corrected = 1):
global memoryOverhead
- f = open("/proc/meminfo", "r")
- mem = f.readlines()[1]
- del f
-
- fields = string.split(mem)
- mem = int(long(fields[1]) / 1024)
+ if not os.access('/proc/e820info', os.R_OK):
+ f = open("/proc/meminfo", "r")
+ mem = f.readlines()[1]
+ del f
+ fields = string.split(mem)
+ mem = int(long(fields[1]) / 1024)
+ else:
+ f = open("/proc/e820info", "r")
+ lines = f.readlines()
+ mem = 0
+ for line in lines:
+ fields = string.split(line)
+ if fields[3] == "(usable)":
+ mem = mem + string.atoi(fields[0], 16)
+
if corrected:
- mem = mem - memoryOverhead
+ mem = mem - memoryOverhead
return mem