summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-01-07 16:55:24 +0300
committerStefan Hajnoczi <stefanha@redhat.com>2016-02-03 09:19:09 +0000
commit41fc57e44ed64cd4ab5393d83624afd897dabd4f (patch)
tree8402d21c2011befea319ad11ba22e14a4bacdb38 /vl.c
parent45bd0b41bdbf554e49fb510673309164c513a8c8 (diff)
trace: split trace_init_file out of trace_init_backends
This is cleaner, and improves error reporting with -daemonize. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1452174932-28657-4-git-send-email-den@openvz.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/vl.c b/vl.c
index ff2a7d5aed..955f364550 100644
--- a/vl.c
+++ b/vl.c
@@ -2988,7 +2988,7 @@ int main(int argc, char **argv, char **envp)
bool userconfig = true;
const char *log_mask = NULL;
const char *log_file = NULL;
- const char *trace_file = NULL;
+ char *trace_file = NULL;
ram_addr_t maxram_size;
uint64_t ram_slots = 0;
FILE *vmstate_dump_file = NULL;
@@ -3905,7 +3905,10 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
trace_init_events(qemu_opt_get(opts, "events"));
- trace_file = qemu_opt_get(opts, "file");
+ if (trace_file) {
+ g_free(trace_file);
+ }
+ trace_file = g_strdup(qemu_opt_get(opts, "file"));
qemu_opts_del(opts);
break;
}
@@ -4089,6 +4092,8 @@ int main(int argc, char **argv, char **envp)
exit(0);
}
+ trace_init_file(trace_file);
+
/* Open the logfile at this point and set the log mask if necessary.
*/
if (log_file) {
@@ -4106,7 +4111,7 @@ int main(int argc, char **argv, char **envp)
}
if (!is_daemonized()) {
- if (!trace_init_backends(trace_file)) {
+ if (!trace_init_backends()) {
exit(1);
}
}
@@ -4653,7 +4658,7 @@ int main(int argc, char **argv, char **envp)
os_setup_post();
if (is_daemonized()) {
- if (!trace_init_backends(trace_file)) {
+ if (!trace_init_backends()) {
exit(1);
}
}