* src/xen_internal.c: fix for system with page size != 4k

Daniel
This commit is contained in:
Daniel Veillard 2006-09-29 16:12:08 +00:00
parent cc3697f722
commit 2c32196a2f
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Fri Sep 29 17:16:40 CEST 2006 Daniel Veillard <veillard@redhat.com>
* src/xen_internal.c: fix for system with page size != 4k
Fri Sep 29 13:05:12 CEST 2006 Daniel Veillard <veillard@redhat.com>
* docs/bugs.html docs/libvir.html: added pointers on how to report

View File

@ -1489,6 +1489,13 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
{
xen_getdomaininfo dominfo;
int ret;
static int kb_per_pages = 0;
if (kb_per_pages == 0) {
kb_per_pages = sysconf(_SC_PAGESIZE) / 1024;
if (kb_per_pages <= 0)
kb_per_pages = 4;
}
if ((conn == NULL) || (conn->handle < 0) || (info == NULL))
return (-1);
@ -1527,8 +1534,8 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
* kilobytes from page counts
*/
info->cpuTime = XEN_GETDOMAININFO_CPUTIME(dominfo);
info->memory = XEN_GETDOMAININFO_TOT_PAGES(dominfo) * 4;
info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo) * 4;
info->memory = XEN_GETDOMAININFO_TOT_PAGES(dominfo) * kb_per_pages;
info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo) * kb_per_pages;
info->nrVirtCpu = XEN_GETDOMAININFO_CPUCOUNT(dominfo);
return (0);
}