From 3050a3f5a65776ad76d820cd8e7bd7a242a3d5b7 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 27 Apr 2016 16:30:21 +0100 Subject: [PATCH] nodeinfo: remove FreeBSD specific code for getting memory The GNULIB physmem module already provides support for the FreeBSD platform, so there's no reason to re-implement FreeBSD portability code in libvirt. If there are bugs in the GNULIB code, we should fix GNULIB rather than workaround it in libvirt. Signed-off-by: Daniel P. Berrange --- src/nodeinfo.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index bc5400f45f..c037a384fd 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -1892,33 +1892,6 @@ nodeGetMemoryFake(unsigned long long *mem, { int ret = -1; -#if defined(__FreeBSD__) - unsigned long pagesize = getpagesize(); - u_int value; - size_t value_size = sizeof(value); - - if (mem) { - if (sysctlbyname("vm.stats.vm.v_page_count", &value, - &value_size, NULL, 0) < 0) { - virReportSystemError(errno, "%s", - _("sysctl failed for vm.stats.vm.v_page_count")); - goto cleanup; - } - *mem = value * (unsigned long long)pagesize; - } - - if (freeMem) { - if (sysctlbyname("vm.stats.vm.v_free_count", &value, - &value_size, NULL, 0) < 0) { - virReportSystemError(errno, "%s", - _("sysctl failed for vm.stats.vm.v_free_count")); - goto cleanup; - } - - *freeMem = value * (unsigned long long)pagesize; - } - -#else if (mem) { double total = physmem_total(); if (!total) { @@ -1941,7 +1914,6 @@ nodeGetMemoryFake(unsigned long long *mem, *freeMem = (unsigned long long) avail; } -#endif ret = 0; cleanup: -- GitLab