From: Marcelo Tosatti <[EMAIL PROTECTED]> Signed-off-by: Marcelo Tosatti <[EMAIL PROTECTED]> Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
diff --git a/qemu/vl.c b/qemu/vl.c index 3f6eca3..8cb827b 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -8748,11 +8748,13 @@ void *alloc_mem_area(unsigned long memory, const char *path) memory = (memory+hpagesize-1) & ~(hpagesize-1); - if (ftruncate(fd, memory) == -1) { - perror("ftruncate"); - close(fd); - return NULL; - } + /* + * ftruncate is not supported by hugetlbfs in older + * hosts, so don't bother checking for errors. + * If anything goes wrong with it under other filesystems, + * mmap will fail. + */ + ftruncate(fd, memory); area = mmap(0, memory, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); if (area == MAP_FAILED) { ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-commits mailing list kvm-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-commits