aboutsummaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorAndreas Färber <andreas.faerber@web.de>2012-04-30 18:00:54 +0200
committerBlue Swirl <blauwirbel@gmail.com>2012-05-01 10:49:23 +0000
commite61ab1da7e98357da47c54d8f893b9bd6ff2f7f9 (patch)
tree8b9825dad53c02b06869bf78415756ce3a17dee1 /qga
parent3239ad04695f95ce060bdc2a0a6e1243d2068971 (diff)
qemu-ga: Implement alternative to O_ASYNC
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 <lee.essen@nowonline.co.uk> Signed-off-by: Andreas Färber <andreas.faerber@web.de> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/channel-posix.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index 40f7658ccd..57eea06c47 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 <stropts.h>
+#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");