From 5fb9b5b9cba9bcf6743a4f884e23152bc9bf4e5a Mon Sep 17 00:00:00 2001 From: Gonglei Date: Thu, 21 Aug 2014 21:03:09 +0800 Subject: [PATCH 1/2] monitor: fix debug print compiling error error: 'i' undeclared (first use in this function) Signed-off-by: Gonglei Signed-off-by: Luiz Capitulino --- monitor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index 34cee74eb3..667efb7a64 100644 --- a/monitor.c +++ b/monitor.c @@ -4747,8 +4747,11 @@ static void monitor_find_completion(void *opaque, return; } #ifdef DEBUG_COMPLETION - for (i = 0; i < nb_args; i++) { - monitor_printf(mon, "arg%d = '%s'\n", i, args[i]); + { + int i; + for (i = 0; i < nb_args; i++) { + monitor_printf(mon, "arg%d = '%s'\n", i, args[i]); + } } #endif From e4d9df4fb16861f413374b69fcdb12c8c7a4a17e Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Mon, 8 Sep 2014 13:50:05 -0400 Subject: [PATCH 2/2] exec: file_ram_alloc(): print error when prealloc fails If memory allocation fails when using the -mem-prealloc command-line option, QEMU exits without printing any error information to the user: # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages # echo $? 1 This commit adds an error message, so that we print instead: # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages qemu: unable to map backing store for hugepages: Cannot allocate memory Signed-off-by: Luiz Capitulino Reviewed-by: Eric Blake --- exec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/exec.c b/exec.c index 7dddcc8034..cb73d16542 100644 --- a/exec.c +++ b/exec.c @@ -1130,6 +1130,7 @@ static void *file_ram_alloc(RAMBlock *block, error: if (mem_prealloc) { + error_report("%s\n", error_get_pretty(*errp)); exit(1); } return NULL;