diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-04-15 10:42:18 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-04-15 10:42:53 +0200 |
commit | b6c00d70308d31517175e50e2115b8c212738ae2 (patch) | |
tree | 97e47ecc76e40e711e0f8e979d6aa7936535110d /main/libvirt/physmem.patch | |
parent | 003673bf5821cbf910ccf637bd319ce2e6aa86fd (diff) | |
download | aports-b6c00d70308d31517175e50e2115b8c212738ae2.tar.bz2 aports-b6c00d70308d31517175e50e2115b8c212738ae2.tar.xz |
main/libvirt: update physmem patch for musl
Diffstat (limited to 'main/libvirt/physmem.patch')
-rw-r--r-- | main/libvirt/physmem.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/main/libvirt/physmem.patch b/main/libvirt/physmem.patch new file mode 100644 index 0000000000..b4901ad581 --- /dev/null +++ b/main/libvirt/physmem.patch @@ -0,0 +1,34 @@ +diff --git a/src/nodeinfo.c b/src/nodeinfo.c +index c88f86c..1fa3e05 100644 +--- a/src/nodeinfo.c ++++ b/src/nodeinfo.c +@@ -38,6 +38,8 @@ + # include <sys/types.h> + # include <sys/sysctl.h> + # include <sys/resource.h> ++#elif defined(__linux__) ++# include <sys/sysinfo.h> + #endif + + #include "c-ctype.h" +@@ -1042,6 +1044,7 @@ int nodeGetInfo(virNodeInfoPtr nodeinfo) + { + int ret = -1; + FILE *cpuinfo = fopen(CPUINFO_PATH, "r"); ++ struct sysinfo si; + if (!cpuinfo) { + virReportSystemError(errno, + _("cannot open %s"), CPUINFO_PATH); +@@ -1053,7 +1056,11 @@ int nodeGetInfo(virNodeInfoPtr nodeinfo) + goto cleanup; + + /* Convert to KB. */ +- nodeinfo->memory = physmem_total() / 1024; ++ if (sysinfo(&si) == 0) { ++ nodeinfo->memory = si.totalram / 1024; ++ } else { ++ nodeinfo->memory = physmem_total() / 1024; ++ } + + cleanup: + VIR_FORCE_FCLOSE(cpuinfo); |