[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/11] aio: support G_IO_HUP and G_IO_ERR
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 11/11] aio: support G_IO_HUP and G_IO_ERR |
Date: |
Thu, 31 Jan 2013 11:54:04 +0100 |
aio-posix.c could not take advantage of G_IO_HUP and G_IO_ERR because
select(2) does not have equivalent events. Now that g_poll(3) is used
we can support G_IO_HUP and G_IO_ERR.
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
aio-posix.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/aio-posix.c b/aio-posix.c
index 303e19f..558ac99 100644
--- a/aio-posix.c
+++ b/aio-posix.c
@@ -88,8 +88,8 @@ void aio_set_fd_handler(AioContext *ctx,
node->opaque = opaque;
node->poller_idx = -1;
- node->pfd.events = (io_read ? G_IO_IN | G_IO_HUP : 0);
- node->pfd.events |= (io_write ? G_IO_OUT : 0);
+ node->pfd.events = (io_read ? G_IO_IN | G_IO_HUP | G_IO_ERR : 0);
+ node->pfd.events |= (io_write ? G_IO_OUT | G_IO_ERR : 0);
}
aio_notify(ctx);
@@ -112,13 +112,6 @@ bool aio_pending(AioContext *ctx)
QLIST_FOREACH(node, &ctx->aio_handlers, node) {
int revents;
- /*
- * FIXME: right now we cannot get G_IO_HUP and G_IO_ERR because
- * main-loop.c is still select based (due to the slirp legacy).
- * If main-loop.c ever switches to poll, G_IO_ERR should be
- * tested too. Dispatching G_IO_ERR to both handlers should be
- * okay, since handlers need to be ready for spurious wakeups.
- */
revents = node->pfd.revents & node->pfd.events;
if (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR) && node->io_read) {
return true;
@@ -150,7 +143,6 @@ static bool aio_dispatch(AioContext *ctx)
revents = node->pfd.revents & node->pfd.events;
node->pfd.revents = 0;
- /* See comment in aio_pending. */
if (!node->deleted &&
(revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) &&
node->io_read) {
--
1.8.1
- Re: [Qemu-devel] [PATCH 02/11] poller: add Poller for growable GPollFD arrays, (continued)
[Qemu-devel] [PATCH 03/11] poller: add poller_fill() and poller_poll(), Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 04/11] main-loop: switch to g_poll() on POSIX hosts, Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 05/11] main-loop: switch POSIX glib integration to Poller, Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 07/11] iohandler: switch to Poller, Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 08/11] main-loop: drop rfds/wfds/xfds for good, Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 06/11] slirp: switch to Poller, Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 09/11] aio: extract aio_dispatch() from aio_poll(), Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 10/11] aio: convert aio_poll() to g_poll(3), Stefan Hajnoczi, 2013/01/31
[Qemu-devel] [PATCH 11/11] aio: support G_IO_HUP and G_IO_ERR,
Stefan Hajnoczi <=