From: Jamie Lokier <jamie@shareable.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org,
Anthony Liguori <aliguori@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] Re: Planning for 0.13
Date: Wed, 6 Jan 2010 23:00:11 +0000 [thread overview]
Message-ID: <20100106230011.GC24250@shareable.org> (raw)
In-Reply-To: <20100106195431.GH4001@redhat.com>
Michael S. Tsirkin wrote:
> On Wed, Jan 06, 2010 at 08:48:16PM +0100, Paolo Bonzini wrote:
> > On 01/06/2010 04:10 PM, Anthony Liguori wrote:
> >> We have ones that require read/write, ones that require send/recv, and
> >> ones that require vhost interaction. Really, the first two are the same
> >> but the distinction is necessary for Windows.
> >
> > Not necessarily, you can open sockets on Windows so that they support
> > read/write. Just create it with
> >
> > fh = WSASocket (domain, type, protocol, NULL, 0, 0);
> >
> > instead of socket. Since Windows already has enough problems passing
> > file descriptors to processes, imposing the above on an external
> > management interface is not a huge chore.
I think socket() is equivalent to that WSASocket() on all modern
Windows versions (since Windows 2000 or so; actually the Windows NT
line and Winsock 2), so there isn't any need for WSASocket.
Passing socket file descriptors isn't very hard (again, the NT line),
but it's different from unix obviously.
On unix you can use a unix domain datagram socket if you're just
communicating with a local process, so recv/send can always be used.
On Windows, you have to use something else for local process
communications (loopback TCP sockets can be used but are sometimes
blocked by annoying software). A smart thing to do would be detect
the type of handle received, and use the appropriate way of talking to
it, but since you need to receive a string to receive a handle anyway,
it's trivial to include an option with the string saying how to talk to it.
> For linux read/write often isn't a good idea :) E.g. for packet
> sockets you really need to use sendmsg and set msg_name with the
> proper protocol. You also must use recvmsg and set MSG_TRUNC
> otherwise packets can get truncatred silently.
On packet sockets, connect() + write() should be equivalent to sendmsg
to the connected addresses. If not it's a bit of a kernel bug. Is it?
Agreed about recvmsg and MSG_TRUNC though.
But anyway, in what situation would you not use recv/send (except
Windows local IPC)? And if there is one, is there ever a situation
where fstat() cannot be used by qemu to decide what to use? If packet
sockets needs sendmsg with msg_name, it could call getpeername and
always use that :-)
-- Jamie
next prev parent reply other threads:[~2010-01-06 23:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-05 12:43 [Qemu-devel] Planning for 0.13 Anthony Liguori
2010-01-05 12:44 ` [Qemu-devel] " Anthony Liguori
2010-01-05 20:50 ` [Qemu-devel] " Stefan Weil
2010-01-05 21:33 ` [Qemu-devel] " Michael S. Tsirkin
2010-01-06 0:32 ` Anthony Liguori
2010-01-06 10:49 ` Michael S. Tsirkin
2010-01-06 12:36 ` Anthony Liguori
2010-01-06 13:20 ` Michael S. Tsirkin
2010-01-06 13:34 ` Anthony Liguori
2010-01-06 13:55 ` Michael S. Tsirkin
2010-01-06 15:10 ` Anthony Liguori
2010-01-06 15:16 ` Michael S. Tsirkin
2010-01-06 15:24 ` Anthony Liguori
2010-01-06 15:41 ` Michael S. Tsirkin
2010-01-06 17:19 ` Jamie Lokier
2010-01-06 18:19 ` Michael S. Tsirkin
2010-01-06 22:49 ` Jamie Lokier
2010-01-06 23:59 ` Michael S. Tsirkin
2010-01-06 19:48 ` Paolo Bonzini
2010-01-06 19:54 ` Michael S. Tsirkin
2010-01-06 19:59 ` Paolo Bonzini
2010-01-06 20:07 ` Michael S. Tsirkin
2010-01-06 23:00 ` Jamie Lokier [this message]
2010-01-07 0:05 ` Michael S. Tsirkin
2010-01-05 22:31 ` [Qemu-devel] " Aurelien Jarno
2010-01-06 2:46 ` Roy Tam
2010-01-06 9:37 ` Gerd Hoffmann
2010-01-06 15:34 ` Adam Litke
2010-01-12 13:43 ` Pasi Kärkkäinen
2010-01-12 15:07 ` Stefano Stabellini
2010-02-09 14:50 ` Artyom Tarasenko
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=20100106230011.GC24250@shareable.org \
--to=jamie@shareable.org \
--cc=aliguori@linux.vnet.ibm.com \
--cc=mst@redhat.com \
--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).