diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-10-08 14:07:52 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-10-10 08:06:56 +0000 |
commit | 167bd52cbba84593c50506b267d821e047e4f6f3 (patch) | |
tree | 0f9ba1bb530e4d380d0d61e12171c531430e9f8c /main/libvirt | |
parent | c0dee56edd72664cd4e7cf7b7f26d4c684a04db0 (diff) | |
download | aports-167bd52cbba84593c50506b267d821e047e4f6f3.tar.bz2 aports-167bd52cbba84593c50506b267d821e047e4f6f3.tar.xz |
main/libvirt: fix available memory reporting
fixes #1401
(cherry picked from commit 135c6a1dcce75df70ff3266cf3d66dd68b39a258)
Conflicts:
main/libvirt/APKBUILD
Diffstat (limited to 'main/libvirt')
-rw-r--r-- | main/libvirt/APKBUILD | 9 | ||||
-rw-r--r-- | main/libvirt/uclibc-physmem.patch | 33 |
2 files changed, 39 insertions, 3 deletions
diff --git a/main/libvirt/APKBUILD b/main/libvirt/APKBUILD index 79d367168..71c3a75b9 100644 --- a/main/libvirt/APKBUILD +++ b/main/libvirt/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Leonardo Arena <rnalrd@alpinelinux.org> pkgname=libvirt pkgver=0.9.13 -pkgrel=1 +pkgrel=2 pkgdesc="A virtualization API for several hypervisor and container systems" url="http://libvirt.org/" arch="all" @@ -16,7 +16,9 @@ install= subpackages="$pkgname-dev $pkgname-doc" source="http://libvirt.org/sources/$pkgname-$pkgver.tar.gz libvirt.confd - libvirt.initd" + libvirt.initd + uclibc-physmem.patch + " _builddir="$srcdir"/$pkgname-$pkgver @@ -46,4 +48,5 @@ package() { md5sums="86cbe53ee662e3b9e8bb0c63c737ba27 libvirt-0.9.13.tar.gz 1c84a7baeafe0a7f4e9d7ae5180311b7 libvirt.confd -7067215010da2d7282d878ba43070c5d libvirt.initd" +7067215010da2d7282d878ba43070c5d libvirt.initd +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); |