[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/3] Make tcp_chr_read() use recvmsg()
From: |
Mark McLoughlin |
Subject: |
[Qemu-devel] [PATCH 1/3] Make tcp_chr_read() use recvmsg() |
Date: |
Mon, 06 Jul 2009 18:30:56 +0100 |
This makes no functional changes, just paves the way for the next
patch.
Signed-off-by: Mark McLoughlin <address@hidden>
---
qemu-char.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 287e0cd..e0d7220 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1911,15 +1911,25 @@ static void tcp_chr_read(void *opaque)
{
CharDriverState *chr = opaque;
TCPCharDriver *s = chr->opaque;
+ struct msghdr msg = { 0, };
+ struct iovec iov[1];
uint8_t buf[1024];
int len, size;
if (!s->connected || s->max_size <= 0)
return;
+
len = sizeof(buf);
if (len > s->max_size)
len = s->max_size;
- size = recv(s->fd, (void *)buf, len, 0);
+
+ iov[0].iov_base = buf;
+ iov[0].iov_len = len;
+
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 1;
+
+ size = recvmsg(s->fd, &msg, 0);
if (size == 0) {
/* connection closed */
s->connected = 0;
--
1.6.2.5
- [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Mark McLoughlin, 2009/07/06
- [Qemu-devel] [PATCH 1/3] Make tcp_chr_read() use recvmsg(),
Mark McLoughlin <=
- Re: [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Avi Kivity, 2009/07/07
- Re: [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Mark McLoughlin, 2009/07/07
- Re: [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Avi Kivity, 2009/07/07
- Re: [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Mark McLoughlin, 2009/07/07
- Re: [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Avi Kivity, 2009/07/07
- Re: [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Daniel P. Berrange, 2009/07/07
- Re: [Qemu-devel] [PATCH 0/3] Allow host_net_add monitor command accept file descriptors, Mark McLoughlin, 2009/07/08
- [Qemu-devel] [PATCH 1/5] Make tcp_chr_read() use recvmsg(), Mark McLoughlin, 2009/07/08