diff options
author | Jeremy Katz <katzj@redhat.com> | 2001-08-09 02:56:56 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2001-08-09 02:56:56 +0000 |
commit | ff26e191f4e6fbbef291211e5746ea2de077fe5d (patch) | |
tree | ae1f14a47b47e13de16e3edcec55440174cc8b03 /iutil.py | |
parent | e56a3730f68c003a52e16600feee47a90fba6b07 (diff) | |
download | anaconda-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.py | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -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 |