mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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 <berrange@redhat.com>
This commit is contained in:
parent
912813de27
commit
3050a3f5a6
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user