From 135c6a1dcce75df70ff3266cf3d66dd68b39a258 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 8 Oct 2012 14:07:52 +0000 Subject: main/libvirt: fix available memory reporting fixes #1401 --- main/libvirt/APKBUILD | 6 ++++-- main/libvirt/uclibc-physmem.patch | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 main/libvirt/uclibc-physmem.patch (limited to 'main/libvirt') diff --git a/main/libvirt/APKBUILD b/main/libvirt/APKBUILD index 87e11152f5..e2f87ff149 100644 --- a/main/libvirt/APKBUILD +++ b/main/libvirt/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Leonardo Arena 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 0000000000..73de5ac4ec --- /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 ++#include + + #if HAVE_SYS_PSTAT_H + # include +@@ -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); -- cgit v1.2.3