mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 04:25:19 +00:00
util: numa: Stub out hugepage code on non-Linux platforms
The hugepage sizing and counting code gathers the information from sysfs and thus isn't portable. Stub it out for non-Linux so that we can report a better error. This patch also avoids calling sysinfo() on Mingw where it isn't supported.
This commit is contained in:
parent
00b2317a66
commit
e6258a333c
@ -512,6 +512,9 @@ virNumaGetDistances(int node ATTRIBUTE_UNUSED,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* currently all the hugepage stuff below is linux only */
|
||||||
|
#if WITH_LINUX
|
||||||
|
|
||||||
# define HUGEPAGES_NUMA_PREFIX "/sys/devices/system/node/"
|
# define HUGEPAGES_NUMA_PREFIX "/sys/devices/system/node/"
|
||||||
# define HUGEPAGES_SYSTEM_PREFIX "/sys/kernel/mm/hugepages/"
|
# define HUGEPAGES_SYSTEM_PREFIX "/sys/kernel/mm/hugepages/"
|
||||||
# define HUGEPAGES_PREFIX "hugepages-"
|
# define HUGEPAGES_PREFIX "hugepages-"
|
||||||
@ -844,3 +847,30 @@ virNumaGetPages(int node,
|
|||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else /* #if WITH_LINUX */
|
||||||
|
int
|
||||||
|
virNumaGetPageInfo(int node ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int page_size ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int *page_avail ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int *page_free ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
|
_("page info is not supported on this platform"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virNumaGetPages(int node ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int **pages_size ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int **pages_avail ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int **pages_free ATTRIBUTE_UNUSED,
|
||||||
|
size_t *npages ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
|
_("page info is not supported on this platform"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif /* #if WITH_LINUX */
|
||||||
|
Loading…
Reference in New Issue
Block a user