From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1H4Q-0001Bf-RI for qemu-devel@nongnu.org; Fri, 01 Feb 2013 08:54:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1H4J-0006XM-Np for qemu-devel@nongnu.org; Fri, 01 Feb 2013 08:54:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1H4J-0006X9-6W for qemu-devel@nongnu.org; Fri, 01 Feb 2013 08:54:15 -0500 From: Stefan Hajnoczi Date: Fri, 1 Feb 2013 14:53:28 +0100 Message-Id: <1359726808-11728-10-git-send-email-stefanha@redhat.com> In-Reply-To: <1359726808-11728-1-git-send-email-stefanha@redhat.com> References: <1359726808-11728-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v2 9/9] aio: support G_IO_HUP and G_IO_ERR List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Jan Kiszka , Fabien Chouteau , Stefan Hajnoczi , Paolo Bonzini , Amos Kong 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 --- aio-posix.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index 7769927..1c5e601 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -88,8 +88,8 @@ void aio_set_fd_handler(AioContext *ctx, node->opaque = opaque; node->pollfds_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