Skip to content

Commit 663d905

Browse files
committed
add -silent option to silence logging
1 parent 0995aed commit 663d905

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

linux-user/main.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,17 @@ const char *qemu_uname_release;
106106
by remapping the process stack directly at the right place */
107107
unsigned long guest_stack_size = 8 * 1024 * 1024UL;
108108

109+
static int silent;
110+
109111
void gemu_log(const char *fmt, ...)
110112
{
111-
va_list ap;
113+
if (!silent) {
114+
va_list ap;
112115

113-
va_start(ap, fmt);
114-
vfprintf(stderr, fmt, ap);
115-
va_end(ap);
116+
va_start(ap, fmt);
117+
vfprintf(stderr, fmt, ap);
118+
va_end(ap);
119+
}
116120
}
117121

118122
#if defined(TARGET_I386)
@@ -4575,6 +4579,11 @@ static void handle_arg_version(const char *arg)
45754579
exit(EXIT_SUCCESS);
45764580
}
45774581

4582+
static void handle_arg_silent(const char *arg)
4583+
{
4584+
silent = 1;
4585+
}
4586+
45784587
static char *trace_file;
45794588
static void handle_arg_trace(const char *arg)
45804589
{
@@ -4635,6 +4644,8 @@ static const struct qemu_argument arg_table[] = {
46354644
"", "[[enable=]<pattern>][,events=<file>][,file=<file>]"},
46364645
{"version", "QEMU_VERSION", false, handle_arg_version,
46374646
"", "display version information and exit"},
4647+
{"silent", "", false, handle_arg_silent,
4648+
"", "silence all logging"},
46384649
{NULL, NULL, false, NULL, NULL, NULL}
46394650
};
46404651

0 commit comments

Comments
 (0)