1
2
3
4
5
6
7
8
9
10
11
12
13#include "qemu/osdep.h"
14#include "monitor/monitor.h"
15#include "qemu/qemu-print.h"
16
17
18
19
20
21int qemu_vprintf(const char *fmt, va_list ap)
22{
23 Monitor *cur_mon = monitor_cur();
24 if (cur_mon) {
25 return monitor_vprintf(cur_mon, fmt, ap);
26 }
27 return vprintf(fmt, ap);
28}
29
30
31
32
33
34int qemu_printf(const char *fmt, ...)
35{
36 va_list ap;
37 int ret;
38
39 va_start(ap, fmt);
40 ret = qemu_vprintf(fmt, ap);
41 va_end(ap);
42 return ret;
43}
44
45
46
47
48
49int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap)
50{
51 if (!stream) {
52 return monitor_vprintf(monitor_cur(), fmt, ap);
53 }
54 return vfprintf(stream, fmt, ap);
55}
56
57
58
59
60
61int qemu_fprintf(FILE *stream, const char *fmt, ...)
62{
63 va_list ap;
64 int ret;
65
66 va_start(ap, fmt);
67 ret = qemu_vfprintf(stream, fmt, ap);
68 va_end(ap);
69 return ret;
70}
71