nbd: Haiku has _IO() in its BSD compatibility layer
[qemu.git] / qemu-tool.c
blobb39af86e0105fc165e03715ecfc3ff6ed63531b3
1 /*
2 * Compatibility for qemu-img/qemu-nbd
4 * Copyright IBM, Corp. 2008
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu-common.h"
15 #include "monitor.h"
16 #include "qemu-timer.h"
17 #include "qemu-log.h"
19 #include <sys/time.h>
21 QEMUClock *rt_clock;
23 FILE *logfile;
25 struct QEMUBH
27 QEMUBHFunc *cb;
28 void *opaque;
31 void qemu_service_io(void)
35 Monitor *cur_mon;
37 int monitor_cur_is_qmp(void)
39 return 0;
42 void monitor_set_error(Monitor *mon, QError *qerror)
46 void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
50 void monitor_printf(Monitor *mon, const char *fmt, ...)
54 void monitor_print_filename(Monitor *mon, const char *filename)
58 void async_context_push(void)
62 void async_context_pop(void)
66 int get_async_context_id(void)
68 return 0;
71 void monitor_protocol_event(MonitorEvent event, QObject *data)
75 QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
77 QEMUBH *bh;
79 bh = qemu_malloc(sizeof(*bh));
80 bh->cb = cb;
81 bh->opaque = opaque;
83 return bh;
86 int qemu_bh_poll(void)
88 return 0;
91 void qemu_bh_schedule(QEMUBH *bh)
93 bh->cb(bh->opaque);
96 void qemu_bh_cancel(QEMUBH *bh)
100 void qemu_bh_delete(QEMUBH *bh)
102 qemu_free(bh);
105 int qemu_set_fd_handler2(int fd,
106 IOCanReadHandler *fd_read_poll,
107 IOHandler *fd_read,
108 IOHandler *fd_write,
109 void *opaque)
111 return 0;
114 int64_t qemu_get_clock(QEMUClock *clock)
116 qemu_timeval tv;
117 qemu_gettimeofday(&tv);
118 return (tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000)) / 1000000;