From: "Andreas Färber" <andreas.faerber@web.de>
To: Paolo Bonzini <pbonzini@redhat.com>,
Lee Essen <lee.essen@nowonline.co.uk>
Cc: Blue Swirl <blauwirbel@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/4] qga/channel-posix: provide Solaris alternative to O_ASYNC
Date: Tue, 27 Mar 2012 17:12:25 +0200 [thread overview]
Message-ID: <4F71D8D9.9070109@web.de> (raw)
In-Reply-To: <4F71D530.30302@redhat.com>
Am 27.03.2012 16:56, schrieb Paolo Bonzini:
> Il 24/03/2012 17:26, Lee Essen ha scritto:
>> Solaris does not support the O_ASYNC option to open, this patch
>> adds the same functionality through the I_SETSIG ioctl.
>>
>> Signed-off-by: Lee Essen <lee.essen@nowonline.co.uk>
>> ---
>> qga/channel-posix.c | 16 ++++++++++++++++
>> 1 files changed, 16 insertions(+), 0 deletions(-)
>>
>> diff --git a/qga/channel-posix.c b/qga/channel-posix.c
>> index 40f7658..86245c1 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 <sys/stropts.h>
>> +#endif
>> +
>> #define GA_CHANNEL_BAUDRATE_DEFAULT B38400 /* for isa-serial channels */
>>
>> struct GAChannel {
>> @@ -123,7 +127,19 @@ static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod
>>
>> switch (c->method) {
>> case GA_CHANNEL_VIRTIO_SERIAL: {
>> +#ifdef CONFIG_SOLARIS
>> + int fd = qemu_open(path, O_RDWR | O_NONBLOCK);
>> + if (fd == -1) {
>> + g_critical("error opening channel: %s", strerror(errno));
>> + exit(EXIT_FAILURE);
>> + }
>> + if (ioctl(fd, I_SETSIG, S_OUTPUT | S_INPUT | S_HIPRI) < 0) {
>> + g_critical("error with setsig on channel: %s", strerror(errno));
>> + exit(EXIT_FAILURE);
>> + }
>> +#else
>> int fd = qemu_open(path, O_RDWR | O_NONBLOCK | O_ASYNC);
>> +#endif
>> if (fd == -1) {
>> g_critical("error opening channel: %s", strerror(errno));
>> exit(EXIT_FAILURE);
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
I would like to see this improved: This unnecessarily duplicates code
into a rarely tested code path, we have the fd == -1 check twice in the
suggested Solaris code path above. I would rather have the ioctl in a
separate ifdef section below to avoid that.
For O_ASYNC someone previously suggested to #define O_ASYNC for Solaris,
for which I have an experimental osdep.h patch in my VM. The two options
were either 0 or O_NDELAY(?) iirc; don't like the former and not sure
about the semantics of the latter. If that's no longer desired, we can
at least restrict the #ifdeffery to | O_ASYNC by breaking the line.
Andreas
next prev parent reply other threads:[~2012-03-27 15:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-24 16:26 [Qemu-devel] [PATCH 1/4] Add socket/xnet libs to configure for Solaris Lee Essen
2012-03-24 16:26 ` [Qemu-devel] [PATCH 2/4] Enable sigbus_reraise " Lee Essen
2012-03-27 7:29 ` Stefan Hajnoczi
2012-03-27 11:41 ` Lee Essen
2012-03-27 11:41 ` Andreas Färber
2012-03-27 11:45 ` Jan Kiszka
2012-03-27 11:47 ` Jan Kiszka
2012-03-27 11:54 ` Jan Kiszka
2012-03-27 13:49 ` Jan Kiszka
2012-03-24 16:26 ` [Qemu-devel] [PATCH 3/4] Enable qemu-timer dynticks " Lee Essen
2012-03-27 15:01 ` Paolo Bonzini
2012-03-27 15:08 ` Jan Kiszka
2012-03-27 15:52 ` Paolo Bonzini
2012-03-27 16:00 ` Jan Kiszka
2012-03-27 17:49 ` Peter Portante
2012-03-24 16:26 ` [Qemu-devel] [PATCH 4/4] qga/channel-posix: provide Solaris alternative to O_ASYNC Lee Essen
2012-03-27 14:56 ` Paolo Bonzini
2012-03-27 15:12 ` Andreas Färber [this message]
2012-03-27 7:23 ` [Qemu-devel] [PATCH 1/4] Add socket/xnet libs to configure for Solaris Stefan Hajnoczi
2012-03-27 11:31 ` Andreas Färber
2012-03-27 12:01 ` Lee Essen
2012-03-27 13:06 ` Stefan Hajnoczi
2012-03-27 13:56 ` Andreas Färber
2012-03-27 17:24 ` Blue Swirl
2012-03-28 18:41 ` Andreas Färber
2012-03-28 19:46 ` Andreas Färber
2012-03-27 13:14 ` Andreas Färber
2012-03-27 17:06 ` Blue Swirl
2012-03-28 17:44 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F71D8D9.9070109@web.de \
--to=andreas.faerber@web.de \
--cc=blauwirbel@gmail.com \
--cc=lee.essen@nowonline.co.uk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).