summaryrefslogtreecommitdiffstats
path: root/main/libvirt
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-10-08 14:07:52 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-10-08 14:07:52 +0000
commit135c6a1dcce75df70ff3266cf3d66dd68b39a258 (patch)
tree4101c6c4f3b6bf809e30ddc037a45b11e592ca43 /main/libvirt
parentb04ab376e0a1393534f5d23dadf99a1fb8bb56ce (diff)
downloadaports-135c6a1dcce75df70ff3266cf3d66dd68b39a258.tar.bz2
aports-135c6a1dcce75df70ff3266cf3d66dd68b39a258.tar.xz
main/libvirt: fix available memory reporting
fixes #1401
Diffstat (limited to 'main/libvirt')
-rw-r--r--main/libvirt/APKBUILD6
-rw-r--r--main/libvirt/uclibc-physmem.patch33
2 files changed, 37 insertions, 2 deletions
diff --git a/main/libvirt/APKBUILD b/main/libvirt/APKBUILD
index 87e11152f..e2f87ff14 100644
--- a/main/libvirt/APKBUILD
+++ b/main/libvirt/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=libvirt
pkgver=0.10.2
-pkgrel=2
+pkgrel=3
pkgdesc="A virtualization API for several hypervisor and container systems"
url="http://libvirt.org/"
arch="all"
@@ -20,6 +20,7 @@ source="http://libvirt.org/sources/$pkgname-$pkgver.tar.gz
libvirt.initd
libvirt-0.10.2-legacy-xen-driver.patch
libvirt-0.10.2-support-xen-sysctl-v9.patch
+ uclibc-physmem.patch
"
_builddir="$srcdir"/$pkgname-$pkgver
@@ -126,4 +127,5 @@ md5sums="a5e50860d9da238ba270b528411c4a0d libvirt-0.10.2.tar.gz
1c84a7baeafe0a7f4e9d7ae5180311b7 libvirt.confd
7067215010da2d7282d878ba43070c5d libvirt.initd
31c0c6ca4fe85bd1cfc00756ec47ea06 libvirt-0.10.2-legacy-xen-driver.patch
-e259b3e5b7257c9301a36186b748195b libvirt-0.10.2-support-xen-sysctl-v9.patch"
+e259b3e5b7257c9301a36186b748195b libvirt-0.10.2-support-xen-sysctl-v9.patch
+df9cbfaf8a6e520a4822914a300add4d uclibc-physmem.patch"
diff --git a/main/libvirt/uclibc-physmem.patch b/main/libvirt/uclibc-physmem.patch
new file mode 100644
index 000000000..73de5ac4e
--- /dev/null
+++ b/main/libvirt/uclibc-physmem.patch
@@ -0,0 +1,33 @@
+--- ./gnulib/lib/physmem.c.orig
++++ ./gnulib/lib/physmem.c
+@@ -23,6 +23,7 @@
+ #include "physmem.h"
+
+ #include <unistd.h>
++#include <stdio.h>
+
+ #if HAVE_SYS_PSTAT_H
+ # include <sys/pstat.h>
+@@ -81,6 +82,22 @@
+ double
+ physmem_total (void)
+ {
++#if defined(__UCLIBC__)
++ char line[128];
++ FILE *f = fopen("/proc/meminfo", "r");
++ long double result = -1;
++ if (f == NULL)
++ return 0;
++ while (!feof(f) && fgets(line, sizeof(line)-1, f)) {
++ if (sscanf(line, "MemTotal: %Lf kB", &result) == 1) {
++ result *= 1024;
++ break;
++ }
++ }
++ fclose(f);
++ return result;
++#endif
++
+ #if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE
+ { /* This works on linux-gnu, solaris2 and cygwin. */
+ double pages = sysconf (_SC_PHYS_PAGES);