]> git.proxmox.com Git - qemu.git/blobdiff - trace/simple.c
trace: avoid conditional code compilation during option parsing
[qemu.git] / trace / simple.c
index de355e96754f9b8be3d0923963f72806e8474061..369e860305611f027e1eec88c9f3ae77ffdb5805 100644 (file)
@@ -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;
 }