blob: 365c9d3261899962b4fca86d144ca1c611d3b6d6 [file] [log] [blame]
Paolo Bonzinid3b12f52011-09-13 10:30:52 +02001/*
2 * QEMU System Emulator
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
Paolo Bonzinid3b12f52011-09-13 10:30:52 +020024
Stefan Weil0ec024f2011-10-25 22:23:17 +020025#include "qemu-common.h"
Paolo Bonzinid3b12f52011-09-13 10:30:52 +020026#include "qemu-timer.h"
Stefan Weil0ec024f2011-10-25 22:23:17 +020027#include "slirp/slirp.h"
28#include "main-loop.h"
Paolo Bonzinif627aab2012-10-29 23:45:23 +010029#include "qemu-aio.h"
Paolo Bonzinid3b12f52011-09-13 10:30:52 +020030
31#ifndef _WIN32
32
Stefan Weil0ec024f2011-10-25 22:23:17 +020033#include "compatfd.h"
34
Paolo Bonzinid3b12f52011-09-13 10:30:52 +020035static int io_thread_fd = -1;
36
37void qemu_notify_event(void)
38{
39 /* Write 8 bytes to be compatible with eventfd. */
40 static const uint64_t val = 1;
41 ssize_t ret;
42
43 if (io_thread_fd == -1) {
44 return;
45 }
46 do {
47 ret = write(io_thread_fd, &val, sizeof(val));
48 } while (ret < 0 && errno == EINTR);
49
50 /* EAGAIN is fine, a read must be pending. */
51 if (ret < 0 && errno != EAGAIN) {
52 fprintf(stderr, "qemu_notify_event: write() failed: %s\n",
53 strerror(errno));
54 exit(1);
55 }
56}
57
58static void qemu_event_read(void *opaque)
59{
60 int fd = (intptr_t)opaque;
61 ssize_t len;
62 char buffer[512];
63
64 /* Drain the notify pipe. For eventfd, only 8 bytes will be read. */
65 do {
66 len = read(fd, buffer, sizeof(buffer));
67 } while ((len == -1 && errno == EINTR) || len == sizeof(buffer));
68}
69
70static int qemu_event_init(void)
71{
72 int err;
73 int fds[2];
74
75 err = qemu_eventfd(fds);
76 if (err == -1) {
77 return -errno;
78 }
79 err = fcntl_setfl(fds[0], O_NONBLOCK);
80 if (err < 0) {
81 goto fail;
82 }
83 err = fcntl_setfl(fds[1], O_NONBLOCK);
84 if (err < 0) {
85 goto fail;
86 }
87 qemu_set_fd_handler2(fds[0], NULL, qemu_event_read, NULL,
88 (void *)(intptr_t)fds[0]);
89
90 io_thread_fd = fds[1];
91 return 0;
92
93fail:
94 close(fds[0]);
95 close(fds[1]);
96 return err;
97}
98
99/* If we have signalfd, we mask out the signals we want to handle and then
100 * use signalfd to listen for them. We rely on whatever the current signal
101 * handler is to dispatch the signals when we receive them.
102 */
103static void sigfd_handler(void *opaque)
104{
105 int fd = (intptr_t)opaque;
106 struct qemu_signalfd_siginfo info;
107 struct sigaction action;
108 ssize_t len;
109
110 while (1) {
111 do {
112 len = read(fd, &info, sizeof(info));
113 } while (len == -1 && errno == EINTR);
114
115 if (len == -1 && errno == EAGAIN) {
116 break;
117 }
118
119 if (len != sizeof(info)) {
120 printf("read from sigfd returned %zd: %m\n", len);
121 return;
122 }
123
124 sigaction(info.ssi_signo, NULL, &action);
125 if ((action.sa_flags & SA_SIGINFO) && action.sa_sigaction) {
126 action.sa_sigaction(info.ssi_signo,
127 (siginfo_t *)&info, NULL);
128 } else if (action.sa_handler) {
129 action.sa_handler(info.ssi_signo);
130 }
131 }
132}
133
134static int qemu_signal_init(void)
135{
136 int sigfd;
137 sigset_t set;
138
139 /*
140 * SIG_IPI must be blocked in the main thread and must not be caught
141 * by sigwait() in the signal thread. Otherwise, the cpu thread will
142 * not catch it reliably.
143 */
144 sigemptyset(&set);
145 sigaddset(&set, SIG_IPI);
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200146 sigaddset(&set, SIGIO);
147 sigaddset(&set, SIGALRM);
148 sigaddset(&set, SIGBUS);
149 pthread_sigmask(SIG_BLOCK, &set, NULL);
150
Lai Jiangshan4aa75342012-01-12 17:05:35 +0800151 sigdelset(&set, SIG_IPI);
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200152 sigfd = qemu_signalfd(&set);
153 if (sigfd == -1) {
154 fprintf(stderr, "failed to create signalfd\n");
155 return -errno;
156 }
157
158 fcntl_setfl(sigfd, O_NONBLOCK);
159
160 qemu_set_fd_handler2(sigfd, NULL, sigfd_handler, NULL,
161 (void *)(intptr_t)sigfd);
162
163 return 0;
164}
165
166#else /* _WIN32 */
167
Frediano Ziglioa92433a2012-03-31 19:32:14 +0100168static HANDLE qemu_event_handle = NULL;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200169
170static void dummy_event_handler(void *opaque)
171{
172}
173
174static int qemu_event_init(void)
175{
176 qemu_event_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
177 if (!qemu_event_handle) {
178 fprintf(stderr, "Failed CreateEvent: %ld\n", GetLastError());
179 return -1;
180 }
181 qemu_add_wait_object(qemu_event_handle, dummy_event_handler, NULL);
182 return 0;
183}
184
185void qemu_notify_event(void)
186{
Michael Rothee77dfb2012-01-20 19:08:27 -0600187 if (!qemu_event_handle) {
188 return;
189 }
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200190 if (!SetEvent(qemu_event_handle)) {
191 fprintf(stderr, "qemu_notify_event: SetEvent failed: %ld\n",
192 GetLastError());
193 exit(1);
194 }
195}
196
197static int qemu_signal_init(void)
198{
199 return 0;
200}
201#endif
202
Paolo Bonzinif627aab2012-10-29 23:45:23 +0100203static AioContext *qemu_aio_context;
204
Paolo Bonzini172061a2012-10-29 15:28:36 +0100205int qemu_init_main_loop(void)
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200206{
207 int ret;
Paolo Bonzini82cbbdc2012-09-24 15:07:08 +0200208 GSource *src;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200209
Paolo Bonzini172061a2012-10-29 15:28:36 +0100210 init_clocks();
211 init_timer_alarm();
212
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200213 qemu_mutex_lock_iothread();
214 ret = qemu_signal_init();
215 if (ret) {
216 return ret;
217 }
218
219 /* Note eventfd must be drained before signalfd handlers run */
220 ret = qemu_event_init();
221 if (ret) {
222 return ret;
223 }
224
Paolo Bonzinif627aab2012-10-29 23:45:23 +0100225 qemu_aio_context = aio_context_new();
Paolo Bonzini82cbbdc2012-09-24 15:07:08 +0200226 src = aio_get_g_source(qemu_aio_context);
227 g_source_attach(src, NULL);
228 g_source_unref(src);
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200229 return 0;
230}
231
Paolo Bonzini15455532012-03-20 10:49:18 +0100232static fd_set rfds, wfds, xfds;
233static int nfds;
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100234static GPollFD poll_fds[1024 * 2]; /* this is probably overkill */
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200235static int n_poll_fds;
236static int max_priority;
237
Paolo Bonziniea26ce72012-03-20 10:49:21 +0100238#ifndef _WIN32
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200239static void glib_select_fill(int *max_fd, fd_set *rfds, fd_set *wfds,
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100240 fd_set *xfds, uint32_t *cur_timeout)
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200241{
242 GMainContext *context = g_main_context_default();
243 int i;
Paolo Bonzini4dae83a2012-03-20 10:49:17 +0100244 int timeout = 0;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200245
246 g_main_context_prepare(context, &max_priority);
247
248 n_poll_fds = g_main_context_query(context, max_priority, &timeout,
249 poll_fds, ARRAY_SIZE(poll_fds));
250 g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds));
251
252 for (i = 0; i < n_poll_fds; i++) {
253 GPollFD *p = &poll_fds[i];
254
255 if ((p->events & G_IO_IN)) {
256 FD_SET(p->fd, rfds);
257 *max_fd = MAX(*max_fd, p->fd);
258 }
259 if ((p->events & G_IO_OUT)) {
260 FD_SET(p->fd, wfds);
261 *max_fd = MAX(*max_fd, p->fd);
262 }
263 if ((p->events & G_IO_ERR)) {
264 FD_SET(p->fd, xfds);
265 *max_fd = MAX(*max_fd, p->fd);
266 }
267 }
268
Paolo Bonzini4dae83a2012-03-20 10:49:17 +0100269 if (timeout >= 0 && timeout < *cur_timeout) {
270 *cur_timeout = timeout;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200271 }
272}
273
274static void glib_select_poll(fd_set *rfds, fd_set *wfds, fd_set *xfds,
275 bool err)
276{
277 GMainContext *context = g_main_context_default();
278
279 if (!err) {
280 int i;
281
282 for (i = 0; i < n_poll_fds; i++) {
283 GPollFD *p = &poll_fds[i];
284
285 if ((p->events & G_IO_IN) && FD_ISSET(p->fd, rfds)) {
286 p->revents |= G_IO_IN;
287 }
288 if ((p->events & G_IO_OUT) && FD_ISSET(p->fd, wfds)) {
289 p->revents |= G_IO_OUT;
290 }
291 if ((p->events & G_IO_ERR) && FD_ISSET(p->fd, xfds)) {
292 p->revents |= G_IO_ERR;
293 }
294 }
295 }
296
297 if (g_main_context_check(context, max_priority, poll_fds, n_poll_fds)) {
298 g_main_context_dispatch(context);
299 }
300}
301
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100302static int os_host_main_loop_wait(uint32_t timeout)
Paolo Bonzini15455532012-03-20 10:49:18 +0100303{
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100304 struct timeval tv, *tvarg = NULL;
Paolo Bonzini15455532012-03-20 10:49:18 +0100305 int ret;
306
307 glib_select_fill(&nfds, &rfds, &wfds, &xfds, &timeout);
308
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100309 if (timeout < UINT32_MAX) {
310 tvarg = &tv;
311 tv.tv_sec = timeout / 1000;
312 tv.tv_usec = (timeout % 1000) * 1000;
313 }
314
Paolo Bonzini15455532012-03-20 10:49:18 +0100315 if (timeout > 0) {
316 qemu_mutex_unlock_iothread();
317 }
318
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100319 ret = select(nfds + 1, &rfds, &wfds, &xfds, tvarg);
Paolo Bonzini15455532012-03-20 10:49:18 +0100320
321 if (timeout > 0) {
322 qemu_mutex_lock_iothread();
323 }
324
325 glib_select_poll(&rfds, &wfds, &xfds, (ret < 0));
326 return ret;
327}
328#else
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200329/***********************************************************/
330/* Polling handling */
331
332typedef struct PollingEntry {
333 PollingFunc *func;
334 void *opaque;
335 struct PollingEntry *next;
336} PollingEntry;
337
338static PollingEntry *first_polling_entry;
339
340int qemu_add_polling_cb(PollingFunc *func, void *opaque)
341{
342 PollingEntry **ppe, *pe;
343 pe = g_malloc0(sizeof(PollingEntry));
344 pe->func = func;
345 pe->opaque = opaque;
346 for(ppe = &first_polling_entry; *ppe != NULL; ppe = &(*ppe)->next);
347 *ppe = pe;
348 return 0;
349}
350
351void qemu_del_polling_cb(PollingFunc *func, void *opaque)
352{
353 PollingEntry **ppe, *pe;
354 for(ppe = &first_polling_entry; *ppe != NULL; ppe = &(*ppe)->next) {
355 pe = *ppe;
356 if (pe->func == func && pe->opaque == opaque) {
357 *ppe = pe->next;
358 g_free(pe);
359 break;
360 }
361 }
362}
363
364/***********************************************************/
365/* Wait objects support */
366typedef struct WaitObjects {
367 int num;
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100368 int revents[MAXIMUM_WAIT_OBJECTS + 1];
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200369 HANDLE events[MAXIMUM_WAIT_OBJECTS + 1];
370 WaitObjectFunc *func[MAXIMUM_WAIT_OBJECTS + 1];
371 void *opaque[MAXIMUM_WAIT_OBJECTS + 1];
372} WaitObjects;
373
374static WaitObjects wait_objects = {0};
375
376int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque)
377{
378 WaitObjects *w = &wait_objects;
379 if (w->num >= MAXIMUM_WAIT_OBJECTS) {
380 return -1;
381 }
382 w->events[w->num] = handle;
383 w->func[w->num] = func;
384 w->opaque[w->num] = opaque;
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100385 w->revents[w->num] = 0;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200386 w->num++;
387 return 0;
388}
389
390void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque)
391{
392 int i, found;
393 WaitObjects *w = &wait_objects;
394
395 found = 0;
396 for (i = 0; i < w->num; i++) {
397 if (w->events[i] == handle) {
398 found = 1;
399 }
400 if (found) {
401 w->events[i] = w->events[i + 1];
402 w->func[i] = w->func[i + 1];
403 w->opaque[i] = w->opaque[i + 1];
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100404 w->revents[i] = w->revents[i + 1];
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200405 }
406 }
407 if (found) {
408 w->num--;
409 }
410}
411
Paolo Bonzinid3385eb2012-03-20 10:49:19 +0100412void qemu_fd_register(int fd)
413{
414 WSAEventSelect(fd, qemu_event_handle, FD_READ | FD_ACCEPT | FD_CLOSE |
415 FD_CONNECT | FD_WRITE | FD_OOB);
416}
417
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100418static int os_host_main_loop_wait(uint32_t timeout)
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200419{
Paolo Bonziniea26ce72012-03-20 10:49:21 +0100420 GMainContext *context = g_main_context_default();
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100421 int ret, i;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200422 PollingEntry *pe;
Paolo Bonzinid3385eb2012-03-20 10:49:19 +0100423 WaitObjects *w = &wait_objects;
Stefan Weil42fe1c22012-04-27 17:02:08 +0200424 gint poll_timeout;
Paolo Bonzini15455532012-03-20 10:49:18 +0100425 static struct timeval tv0;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200426
427 /* XXX: need to suppress polling by better using win32 events */
428 ret = 0;
429 for (pe = first_polling_entry; pe != NULL; pe = pe->next) {
430 ret |= pe->func(pe->opaque);
431 }
Paolo Bonzinid3385eb2012-03-20 10:49:19 +0100432 if (ret != 0) {
433 return ret;
434 }
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200435
Paolo Bonzinid3385eb2012-03-20 10:49:19 +0100436 if (nfds >= 0) {
437 ret = select(nfds + 1, &rfds, &wfds, &xfds, &tv0);
438 if (ret != 0) {
Stefan Weil3239ad02012-04-29 19:15:02 +0200439 timeout = 0;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200440 }
441 }
442
Paolo Bonziniea26ce72012-03-20 10:49:21 +0100443 g_main_context_prepare(context, &max_priority);
Stefan Weil42fe1c22012-04-27 17:02:08 +0200444 n_poll_fds = g_main_context_query(context, max_priority, &poll_timeout,
Paolo Bonziniea26ce72012-03-20 10:49:21 +0100445 poll_fds, ARRAY_SIZE(poll_fds));
446 g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds));
447
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100448 for (i = 0; i < w->num; i++) {
Stefan Weil58b96302012-04-12 20:42:34 +0200449 poll_fds[n_poll_fds + i].fd = (DWORD_PTR)w->events[i];
Paolo Bonziniea26ce72012-03-20 10:49:21 +0100450 poll_fds[n_poll_fds + i].events = G_IO_IN;
Paolo Bonzinid3385eb2012-03-20 10:49:19 +0100451 }
452
Stefan Weil3239ad02012-04-29 19:15:02 +0200453 if (poll_timeout < 0 || timeout < poll_timeout) {
454 poll_timeout = timeout;
455 }
456
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100457 qemu_mutex_unlock_iothread();
Stefan Weil42fe1c22012-04-27 17:02:08 +0200458 ret = g_poll(poll_fds, n_poll_fds + w->num, poll_timeout);
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100459 qemu_mutex_lock_iothread();
460 if (ret > 0) {
461 for (i = 0; i < w->num; i++) {
Paolo Bonziniea26ce72012-03-20 10:49:21 +0100462 w->revents[i] = poll_fds[n_poll_fds + i].revents;
Paolo Bonzini06ac7d42012-03-20 10:49:20 +0100463 }
464 for (i = 0; i < w->num; i++) {
465 if (w->revents[i] && w->func[i]) {
466 w->func[i](w->opaque[i]);
467 }
468 }
469 }
Paolo Bonzinid3385eb2012-03-20 10:49:19 +0100470
Paolo Bonziniea26ce72012-03-20 10:49:21 +0100471 if (g_main_context_check(context, max_priority, poll_fds, n_poll_fds)) {
472 g_main_context_dispatch(context);
473 }
474
Paolo Bonzinid3385eb2012-03-20 10:49:19 +0100475 /* If an edge-triggered socket event occurred, select will return a
476 * positive result on the next iteration. We do not need to do anything
477 * here.
478 */
479
Paolo Bonzini15455532012-03-20 10:49:18 +0100480 return ret;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200481}
482#endif
483
484int main_loop_wait(int nonblocking)
485{
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100486 int ret;
487 uint32_t timeout = UINT32_MAX;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200488
489 if (nonblocking) {
490 timeout = 0;
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200491 }
492
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200493 /* poll any events */
494 /* XXX: separate device handlers from system ones */
495 nfds = -1;
496 FD_ZERO(&rfds);
497 FD_ZERO(&wfds);
498 FD_ZERO(&xfds);
499
500#ifdef CONFIG_SLIRP
Stefano Stabellini7c7db752012-04-13 19:35:04 +0100501 slirp_update_timeout(&timeout);
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200502 slirp_select_fill(&nfds, &rfds, &wfds, &xfds);
503#endif
504 qemu_iohandler_fill(&nfds, &rfds, &wfds, &xfds);
Paolo Bonzini15455532012-03-20 10:49:18 +0100505 ret = os_host_main_loop_wait(timeout);
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200506 qemu_iohandler_poll(&rfds, &wfds, &xfds, ret);
507#ifdef CONFIG_SLIRP
508 slirp_select_poll(&rfds, &wfds, &xfds, (ret < 0));
509#endif
510
511 qemu_run_all_timers();
512
Paolo Bonzinid3b12f52011-09-13 10:30:52 +0200513 return ret;
514}
Paolo Bonzinif627aab2012-10-29 23:45:23 +0100515
516/* Functions to operate on the main QEMU AioContext. */
517
518QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
519{
520 return aio_bh_new(qemu_aio_context, cb, opaque);
521}
522
Paolo Bonzinia915f4b2012-09-13 12:28:51 +0200523void qemu_aio_flush(void)
524{
525 aio_flush(qemu_aio_context);
526}
527
528bool qemu_aio_wait(void)
529{
Paolo Bonzini7c0628b2012-09-24 14:37:53 +0200530 return aio_poll(qemu_aio_context, true);
Paolo Bonzinia915f4b2012-09-13 12:28:51 +0200531}
532
Paolo Bonzinif42b2202012-06-09 04:01:51 +0200533#ifdef CONFIG_POSIX
Paolo Bonzinia915f4b2012-09-13 12:28:51 +0200534void qemu_aio_set_fd_handler(int fd,
535 IOHandler *io_read,
536 IOHandler *io_write,
537 AioFlushHandler *io_flush,
538 void *opaque)
539{
540 aio_set_fd_handler(qemu_aio_context, fd, io_read, io_write, io_flush,
541 opaque);
Paolo Bonzinia915f4b2012-09-13 12:28:51 +0200542}
Paolo Bonzini82cbbdc2012-09-24 15:07:08 +0200543#endif
Paolo Bonzinia915f4b2012-09-13 12:28:51 +0200544
Paolo Bonzinia915f4b2012-09-13 12:28:51 +0200545void qemu_aio_set_event_notifier(EventNotifier *notifier,
546 EventNotifierHandler *io_read,
547 AioFlushEventNotifierHandler *io_flush)
548{
Paolo Bonzini82cbbdc2012-09-24 15:07:08 +0200549 aio_set_event_notifier(qemu_aio_context, notifier, io_read, io_flush);
Paolo Bonzinia915f4b2012-09-13 12:28:51 +0200550}