diff options
author | Lluís <xscript@gmx.net> | 2011-08-31 20:31:03 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-09-01 10:34:53 +0100 |
commit | e4858974ec36afd8a6b3a9e2b0ad8f357f28efc7 (patch) | |
tree | ceb7f2b2cdff3c511e1807e65eb862b82cfac16c /trace/simple.c | |
parent | edb47ec498a5c00607e8d428668d5141822a9eac (diff) |
trace: avoid conditional code compilation during option parsing
A default implementation for backend-specific routines is provided in
"trace/default.c", which backends can override by setting "trace_default=no" in
"configure".
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Diffstat (limited to 'trace/simple.c')
-rw-r--r-- | trace/simple.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/trace/simple.c b/trace/simple.c index de355e9675..369e860305 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -16,6 +16,7 @@ #include <pthread.h> #include "qemu-timer.h" #include "trace.h" +#include "trace/control.h" /** Trace file header event ID */ #define HEADER_EVENT_ID (~(uint64_t)0) /* avoids conflicting with TraceEventIDs */ @@ -330,7 +331,7 @@ void st_flush_trace_buffer(void) flush_trace_file(true); } -bool st_init(const char *file) +bool trace_backend_init(const char *file) { pthread_t thread; pthread_attr_t attr; @@ -346,10 +347,11 @@ bool st_init(const char *file) pthread_sigmask(SIG_SETMASK, &oldset, NULL); if (ret != 0) { - return false; + fprintf(stderr, "warning: unable to initialize simple trace backend\n"); + } else { + atexit(st_flush_trace_buffer); + st_set_trace_file(file); } - atexit(st_flush_trace_buffer); - st_set_trace_file(file); return true; } |