From 7eb0292a262c2608f06a41a8a10e0b7c21b159a4 Mon Sep 17 00:00:00 2001 Message-Id: <7eb0292a262c2608f06a41a8a10e0b7c21b159a4.1342518105.git.minovotn@redhat.com> In-Reply-To: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com> References: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com> From: Luiz Capitulino Date: Tue, 5 Jun 2012 14:58:33 +0200 Subject: [PATCH 24/41] qemu-ga: Implement alternative to O_ASYNC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Luiz Capitulino Message-id: <1338908331-15633-19-git-send-email-lcapitulino@redhat.com> Patchwork-id: 39915 O-Subject: [PATCH RHEL6.4 qemu-kvm 18/36] qemu-ga: Implement alternative to O_ASYNC Bugzilla: 827612 RH-Acked-by: Paolo Bonzini RH-Acked-by: Juan Quintela RH-Acked-by: Jeffrey Cody From: Andreas Färber ga_channel_open() was using open flag O_ASYNC for SIGIO-driven I/O. This breaks on illumos, so fall back to POSIX I_SETSIG ioctl (SIGPOLL). Signed-off-by: Lee Essen Signed-off-by: Andreas Färber Reviewed-by: Stefan Hajnoczi Signed-off-by: Blue Swirl (cherry picked from commit e61ab1da7e98357da47c54d8f893b9bd6ff2f7f9) Signed-off-by: Luiz Capitulino --- qga/channel-posix.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) Signed-off-by: Michal Novotny --- qga/channel-posix.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/qga/channel-posix.c b/qga/channel-posix.c index 40f7658..57eea06 100644 --- a/qga/channel-posix.c +++ b/qga/channel-posix.c @@ -3,6 +3,10 @@ #include "qemu_socket.h" #include "qga/channel.h" +#ifdef CONFIG_SOLARIS +#include +#endif + #define GA_CHANNEL_BAUDRATE_DEFAULT B38400 /* for isa-serial channels */ struct GAChannel { @@ -123,11 +127,23 @@ static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod switch (c->method) { case GA_CHANNEL_VIRTIO_SERIAL: { - int fd = qemu_open(path, O_RDWR | O_NONBLOCK | O_ASYNC); + int fd = qemu_open(path, O_RDWR | O_NONBLOCK +#ifndef CONFIG_SOLARIS + | O_ASYNC +#endif + ); if (fd == -1) { g_critical("error opening channel: %s", strerror(errno)); exit(EXIT_FAILURE); } +#ifdef CONFIG_SOLARIS + ret = ioctl(fd, I_SETSIG, S_OUTPUT | S_INPUT | S_HIPRI); + if (ret == -1) { + g_critical("error setting event mask for channel: %s", + strerror(errno)); + exit(EXIT_FAILURE); + } +#endif ret = ga_channel_client_add(c, fd); if (ret) { g_critical("error adding channel to main loop"); -- 1.7.10.4