- take swap space into account durint ulimit settings. Fixes qemu arm builds
authorAdrian Schröter <adrian@suse.de>
Wed, 1 Feb 2012 10:42:46 +0000 (11:42 +0100)
committerAdrian Schröter <adrian@suse.de>
Wed, 1 Feb 2012 10:42:46 +0000 (11:42 +0100)
build

diff --git a/build b/build
index 3c263ef..0fcb1f4 100755 (executable)
--- a/build
+++ b/build
@@ -432,17 +432,22 @@ setmemorylimit()
        return
     fi
     local mem
+    local limit
     while read mem; do
        case "$mem" in
            MemTotal:*)
                set -- $mem
-               eval "mem=\$(($2/3*4))"
-               ulimit -v $mem
-               echo "Memory limit set to ${mem}KB"
-               break;
+               eval "limit=\$(($2/3*4))"
+           ;;
+           SwapTotal:*)
+               set -- $mem
+               eval "limit=\$(($2/3*4+$limit))"
            ;;
        esac
     done < <(cat /proc/meminfo) # cat for proc stuff
+
+    ulimit -v $limit
+    echo "Memory limit set to ${limit}KB"
 }
 
 create_baselibs()