Commit 31d3c9b8 authored by Stefan Hajnoczi's avatar Stefan Hajnoczi Committed by Blue Swirl
Browse files

simpletrace: Move st_init() error reporting



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: default avatarBlue Swirl <blauwirbel@gmail.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: default avatarBlue Swirl <blauwirbel@gmail.com>
parent cc015e9a
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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;
}
+3 −3
Original line number Diff line number Diff line
@@ -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 */

+3 −1
Original line number Diff line number Diff line
@@ -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.  */