提交 3050a3f5 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 912813de
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册