]> git.proxmox.com Git - qemu.git/commitdiff
simpletrace: Move st_init() error reporting
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Sun, 13 Mar 2011 20:14:30 +0000 (20:14 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Tue, 15 Mar 2011 18:03:26 +0000 (18:03 +0000)
User emulator builds do not have error_report() so it should not be used
by simpletrace.c.  In fact, error reporting inside simpletrace.c is
inappropriate and should be done by the caller instead.

This patch moves st_init() error reporting out to its caller,
vl.c:main().

Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
simpletrace.c
simpletrace.h
vl.c

index 9926ab39bb25a53f66cde4223faa47d5013290ca..f1dbb5e502238cf0fcc3eeb440d64a65c0afdedf 100644 (file)
@@ -14,7 +14,6 @@
 #include <time.h>
 #include <signal.h>
 #include <pthread.h>
-#include "qerror.h"
 #include "qemu-timer.h"
 #include "trace.h"
 
@@ -331,7 +330,7 @@ void st_flush_trace_buffer(void)
     flush_trace_file(true);
 }
 
-void st_init(const char *file)
+bool st_init(const char *file)
 {
     pthread_t thread;
     pthread_attr_t attr;
@@ -347,10 +346,10 @@ void st_init(const char *file)
     pthread_sigmask(SIG_SETMASK, &oldset, NULL);
 
     if (ret != 0) {
-        error_report("warning: unable to create trace file thread\n");
-        return;
+        return false;
     }
 
     atexit(st_flush_trace_buffer);
     st_set_trace_file(file);
+    return true;
 }
index 3a5bd9fb9d5c3485e27ec0278ad735fcf5ca22eb..8d893bd849175b9eae8d213d783d893bd9e7bb9c 100644 (file)
@@ -37,11 +37,11 @@ void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
 void st_set_trace_file_enabled(bool enable);
 bool st_set_trace_file(const char *file);
 void st_flush_trace_buffer(void);
-void st_init(const char *file);
+bool st_init(const char *file);
 #else
-static inline void st_init(const char *file)
+static inline bool st_init(const char *file)
 {
-    /* Do nothing */
+    return true;
 }
 #endif /* !CONFIG_SIMPLE_TRACE */
 
diff --git a/vl.c b/vl.c
index 5e007a764cf58f7952a7cbfdaae1d362dbe1678d..b1a94aa6d5e8ea73f9415e5ce55abf7f8b8e5a3d 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2766,7 +2766,9 @@ int main(int argc, char **argv, char **envp)
     }
     loc_set_none();
 
-    st_init(trace_file);
+    if (!st_init(trace_file)) {
+        fprintf(stderr, "warning: unable to initialize simple trace backend\n");
+    }
 
     /* If no data_dir is specified then try to find it relative to the
        executable path.  */