aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block/sheepdog.c2
-rw-r--r--gdbstub.c2
-rw-r--r--linux-user/syscall.c2
-rw-r--r--nbd.c2
-rw-r--r--net/socket.c4
-rw-r--r--qemu-char.c4
-rw-r--r--qemu-common.h6
-rw-r--r--savevm.c2
-rw-r--r--slirp/ip_icmp.c2
-rw-r--r--slirp/slirp.c2
-rw-r--r--slirp/socket.c4
-rw-r--r--ui/vnc-tls.c2
-rw-r--r--ui/vnc.c2
13 files changed, 21 insertions, 15 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 77a4de5100..e150ac0123 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -496,7 +496,7 @@ static ssize_t recvmsg(int s, struct msghdr *msg, int flags)
}
buf = qemu_malloc(size);
- ret = recv(s, buf, size, flags);
+ ret = qemu_recv(s, buf, size, flags);
if (ret < 0) {
goto out;
}
diff --git a/gdbstub.c b/gdbstub.c
index c085a5afb3..27b0cfa81d 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -319,7 +319,7 @@ static int get_char(GDBState *s)
int ret;
for(;;) {
- ret = recv(s->fd, &ch, 1, 0);
+ ret = qemu_recv(s->fd, &ch, 1, 0);
if (ret < 0) {
if (errno == ECONNRESET)
s->fd = -1;
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1dd7aad43c..73f9baa6f9 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2004,7 +2004,7 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags,
ret = get_errno(recvfrom(fd, host_msg, len, flags, addr, &addrlen));
} else {
addr = NULL; /* To keep compiler quiet. */
- ret = get_errno(recv(fd, host_msg, len, flags));
+ ret = get_errno(qemu_recv(fd, host_msg, len, flags));
}
if (!is_error(ret)) {
if (target_addr) {
diff --git a/nbd.c b/nbd.c
index 0dcd86b52f..e7a585dcb0 100644
--- a/nbd.c
+++ b/nbd.c
@@ -78,7 +78,7 @@ size_t nbd_wr_sync(int fd, void *buffer, size_t size, bool do_read)
ssize_t len;
if (do_read) {
- len = recv(fd, buffer + offset, size - offset, 0);
+ len = qemu_recv(fd, buffer + offset, size - offset, 0);
} else {
len = send(fd, buffer + offset, size - offset, 0);
}
diff --git a/net/socket.c b/net/socket.c
index bc1bf58894..11fe5f383f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -76,7 +76,7 @@ static void net_socket_send(void *opaque)
uint8_t buf1[4096];
const uint8_t *buf;
- size = recv(s->fd, (void *)buf1, sizeof(buf1), 0);
+ size = qemu_recv(s->fd, buf1, sizeof(buf1), 0);
if (size < 0) {
err = socket_error();
if (err != EWOULDBLOCK)
@@ -138,7 +138,7 @@ static void net_socket_send_dgram(void *opaque)
NetSocketState *s = opaque;
int size;
- size = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0);
+ size = qemu_recv(s->fd, s->buf, sizeof(s->buf), 0);
if (size < 0)
return;
if (size == 0) {
diff --git a/qemu-char.c b/qemu-char.c
index 2982bfd7bb..8e8cf31a29 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1860,7 +1860,7 @@ static void udp_chr_read(void *opaque)
if (s->max_size == 0)
return;
- s->bufcnt = recv(s->fd, (void *)s->buf, sizeof(s->buf), 0);
+ s->bufcnt = qemu_recv(s->fd, s->buf, sizeof(s->buf), 0);
s->bufptr = s->bufcnt;
if (s->bufcnt <= 0)
return;
@@ -2078,7 +2078,7 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len)
{
TCPCharDriver *s = chr->opaque;
- return recv(s->fd, buf, len, 0);
+ return qemu_recv(s->fd, buf, len, 0);
}
#endif
diff --git a/qemu-common.h b/qemu-common.h
index ba55719700..391fadda56 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -200,6 +200,12 @@ int qemu_eventfd(int pipefd[2]);
int qemu_pipe(int pipefd[2]);
#endif
+#ifdef _WIN32
+#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
+#else
+#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
+#endif
+
/* Error handling. */
void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
diff --git a/savevm.c b/savevm.c
index 8139bc7e29..79db4cbd18 100644
--- a/savevm.c
+++ b/savevm.c
@@ -194,7 +194,7 @@ static int socket_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
ssize_t len;
do {
- len = recv(s->fd, (void *)buf, size, 0);
+ len = qemu_recv(s->fd, buf, size, 0);
} while (len == -1 && socket_error() == EINTR);
if (len == -1)
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index 14a5312c84..4b43994dbc 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -415,7 +415,7 @@ void icmp_receive(struct socket *so)
icp = mtod(m, struct icmp *);
id = icp->icmp_id;
- len = recv(so->s, icp, m->m_len, 0);
+ len = qemu_recv(so->s, icp, m->m_len, 0);
icp->icmp_id = id;
m->m_data -= hlen;
diff --git a/slirp/slirp.c b/slirp/slirp.c
index faaa2f36c7..df787ea1d9 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -522,7 +522,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds,
*/
#ifdef PROBE_CONN
if (so->so_state & SS_ISFCONNECTING) {
- ret = recv(so->s, (char *)&ret, 0,0);
+ ret = qemu_recv(so->s, &ret, 0,0);
if (ret < 0) {
/* XXX */
diff --git a/slirp/socket.c b/slirp/socket.c
index 9b8ae13f5e..77b0c98197 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -166,7 +166,7 @@ soread(struct socket *so)
nn = readv(so->s, (struct iovec *)iov, n);
DEBUG_MISC((dfd, " ... read nn = %d bytes\n", nn));
#else
- nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
+ nn = qemu_recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
#endif
if (nn <= 0) {
if (nn < 0 && (errno == EINTR || errno == EAGAIN))
@@ -191,7 +191,7 @@ soread(struct socket *so)
*/
if (n == 2 && nn == iov[0].iov_len) {
int ret;
- ret = recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
+ ret = qemu_recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
if (ret > 0)
nn += ret;
}
diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c
index dec626c539..31f1467ad0 100644
--- a/ui/vnc-tls.c
+++ b/ui/vnc-tls.c
@@ -89,7 +89,7 @@ static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport,
int ret;
retry:
- ret = recv(vs->csock, data, len, 0);
+ ret = qemu_recv(vs->csock, data, len, 0);
if (ret < 0) {
if (errno == EINTR)
goto retry;
diff --git a/ui/vnc.c b/ui/vnc.c
index 4425180a84..f1e27d97b8 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1199,7 +1199,7 @@ long vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen)
}
} else
#endif /* CONFIG_VNC_TLS */
- ret = recv(vs->csock, (void *)data, datalen, 0);
+ ret = qemu_recv(vs->csock, data, datalen, 0);
VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
return vnc_client_io_error(vs, ret, socket_error());
}