aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crypto/cipher-afalg.c4
-rw-r--r--crypto/hash-afalg.c4
-rw-r--r--gdbstub.c2
-rw-r--r--include/qemu-common.h19
-rw-r--r--io/channel-socket.c6
-rw-r--r--net/socket.c24
-rw-r--r--tests/qtest/e1000e-test.c4
-rw-r--r--tests/qtest/libqtest.c4
-rw-r--r--tests/qtest/npcm7xx_emc-test.c4
-rw-r--r--tests/qtest/test-filter-mirror.c4
-rw-r--r--tests/qtest/test-filter-redirector.c8
-rw-r--r--tests/qtest/virtio-net-test.c10
-rw-r--r--tests/unit/socket-helpers.c2
-rw-r--r--util/osdep.c4
-rw-r--r--util/qemu-sockets.c10
15 files changed, 45 insertions, 64 deletions
diff --git a/crypto/cipher-afalg.c b/crypto/cipher-afalg.c
index 052355a8a9..c55cd28bf0 100644
--- a/crypto/cipher-afalg.c
+++ b/crypto/cipher-afalg.c
@@ -84,8 +84,8 @@ qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
g_free(name);
/* setkey */
- if (qemu_setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY, key,
- nkey) != 0) {
+ if (setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY, key,
+ nkey) != 0) {
error_setg_errno(errp, errno, "Set key failed");
qcrypto_afalg_comm_free(afalg);
return NULL;
diff --git a/crypto/hash-afalg.c b/crypto/hash-afalg.c
index cf34c694af..4ac18c7c1d 100644
--- a/crypto/hash-afalg.c
+++ b/crypto/hash-afalg.c
@@ -88,8 +88,8 @@ qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgorithm alg,
/* HMAC needs setkey */
if (is_hmac) {
- if (qemu_setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY,
- key, nkey) != 0) {
+ if (setsockopt(afalg->tfmfd, SOL_ALG, ALG_SET_KEY,
+ key, nkey) != 0) {
error_setg_errno(errp, errno, "Set hmac key failed");
qcrypto_afalg_comm_free(afalg);
return NULL;
diff --git a/gdbstub.c b/gdbstub.c
index 3c14c6a038..c8375e3c3f 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -426,7 +426,7 @@ static int get_char(void)
int ret;
for(;;) {
- ret = qemu_recv(gdbserver_state.fd, &ch, 1, 0);
+ ret = recv(gdbserver_state.fd, &ch, 1, 0);
if (ret < 0) {
if (errno == ECONNRESET)
gdbserver_state.fd = -1;
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 8c0d9ab0f7..9c04fa94e8 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -35,25 +35,6 @@ int qemu_pipe(int pipefd[2]);
int qemu_openpty_raw(int *aslave, char *pty_name);
#endif
-#ifdef _WIN32
-/* MinGW needs type casts for the 'buf' and 'optval' arguments. */
-#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
- getsockopt(sockfd, level, optname, (void *)optval, optlen)
-#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
- setsockopt(sockfd, level, optname, (const void *)optval, optlen)
-#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
-#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
- sendto(sockfd, (const void *)buf, len, flags, destaddr, addrlen)
-#else
-#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
- getsockopt(sockfd, level, optname, optval, optlen)
-#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
- setsockopt(sockfd, level, optname, optval, optlen)
-#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
-#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
- sendto(sockfd, buf, len, flags, destaddr, addrlen)
-#endif
-
void cpu_exec_init_all(void);
void cpu_exec_step_atomic(CPUState *cpu);
diff --git a/io/channel-socket.c b/io/channel-socket.c
index 459922c874..7a8d9f69c9 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -681,9 +681,9 @@ qio_channel_socket_set_delay(QIOChannel *ioc,
QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
int v = enabled ? 0 : 1;
- qemu_setsockopt(sioc->fd,
- IPPROTO_TCP, TCP_NODELAY,
- &v, sizeof(v));
+ setsockopt(sioc->fd,
+ IPPROTO_TCP, TCP_NODELAY,
+ &v, sizeof(v));
}
diff --git a/net/socket.c b/net/socket.c
index 15b410e8d8..c4b80e9228 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -120,9 +120,9 @@ static ssize_t net_socket_receive_dgram(NetClientState *nc, const uint8_t *buf,
do {
if (s->dgram_dst.sin_family != AF_UNIX) {
- ret = qemu_sendto(s->fd, buf, size, 0,
- (struct sockaddr *)&s->dgram_dst,
- sizeof(s->dgram_dst));
+ ret = sendto(s->fd, buf, size, 0,
+ (struct sockaddr *)&s->dgram_dst,
+ sizeof(s->dgram_dst));
} else {
ret = send(s->fd, buf, size, 0);
}
@@ -163,7 +163,7 @@ static void net_socket_send(void *opaque)
uint8_t buf1[NET_BUFSIZE];
const uint8_t *buf;
- size = qemu_recv(s->fd, buf1, sizeof(buf1), 0);
+ size = recv(s->fd, buf1, sizeof(buf1), 0);
if (size < 0) {
if (errno != EWOULDBLOCK)
goto eoc;
@@ -198,7 +198,7 @@ static void net_socket_send_dgram(void *opaque)
NetSocketState *s = opaque;
int size;
- size = qemu_recv(s->fd, s->rs.buf, sizeof(s->rs.buf), 0);
+ size = recv(s->fd, s->rs.buf, sizeof(s->rs.buf), 0);
if (size < 0)
return;
if (size == 0) {
@@ -246,7 +246,7 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
* only on posix systems.
*/
val = 1;
- ret = qemu_setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
+ ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
if (ret < 0) {
error_setg_errno(errp, errno,
"can't set socket option SO_REUSEADDR");
@@ -268,8 +268,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
imr.imr_interface.s_addr = htonl(INADDR_ANY);
}
- ret = qemu_setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- &imr, sizeof(struct ip_mreq));
+ ret = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+ &imr, sizeof(struct ip_mreq));
if (ret < 0) {
error_setg_errno(errp, errno,
"can't add socket to multicast group %s",
@@ -279,8 +279,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
/* Force mcast msgs to loopback (eg. several QEMUs in same host */
loop = 1;
- ret = qemu_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- &loop, sizeof(loop));
+ ret = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
+ &loop, sizeof(loop));
if (ret < 0) {
error_setg_errno(errp, errno,
"can't force multicast message to loopback");
@@ -289,8 +289,8 @@ static int net_socket_mcast_create(struct sockaddr_in *mcastaddr,
/* If a bind address is given, only send packets from that address */
if (localaddr != NULL) {
- ret = qemu_setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
- localaddr, sizeof(*localaddr));
+ ret = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
+ localaddr, sizeof(*localaddr));
if (ret < 0) {
error_setg_errno(errp, errno,
"can't set the default network send interface");
diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
index 0273fe4c15..e648fdd409 100644
--- a/tests/qtest/e1000e-test.c
+++ b/tests/qtest/e1000e-test.c
@@ -91,9 +91,9 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
g_assert_cmphex(le32_to_cpu(descr.upper.data) & dsta_dd, ==, dsta_dd);
/* Check data sent to the backend */
- ret = qemu_recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
+ ret = recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
g_assert_cmpint(ret, == , sizeof(recv_len));
- ret = qemu_recv(test_sockets[0], buffer, 64, 0);
+ ret = recv(test_sockets[0], buffer, 64, 0);
g_assert_cmpint(ret, >=, 5);
g_assert_cmpstr(buffer, == , "TEST");
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 41f4da4e54..9dac018fcb 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -94,8 +94,8 @@ static int socket_accept(int sock)
struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT,
.tv_usec = 0 };
- if (qemu_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
- (void *)&timeout, sizeof(timeout))) {
+ if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
+ (void *)&timeout, sizeof(timeout))) {
fprintf(stderr, "%s failed to set SO_RCVTIMEO: %s\n",
__func__, strerror(errno));
close(sock);
diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c
index 9eec71d87c..7c435ac915 100644
--- a/tests/qtest/npcm7xx_emc-test.c
+++ b/tests/qtest/npcm7xx_emc-test.c
@@ -521,12 +521,12 @@ static void emc_send_verify1(QTestState *qts, const EMCModule *mod, int fd,
/* Check data sent to the backend. */
recv_len = ~0;
- ret = qemu_recv(fd, &recv_len, sizeof(recv_len), MSG_DONTWAIT);
+ ret = recv(fd, &recv_len, sizeof(recv_len), MSG_DONTWAIT);
g_assert_cmpint(ret, == , sizeof(recv_len));
g_assert(wait_socket_readable(fd));
memset(buffer, 0xff, sizeof(buffer));
- ret = qemu_recv(fd, buffer, test_size, MSG_DONTWAIT);
+ ret = recv(fd, buffer, test_size, MSG_DONTWAIT);
g_assert_cmpmem(buffer, ret, test_data, test_size);
}
diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mirror.c
index 95367d14d3..da4f94de72 100644
--- a/tests/qtest/test-filter-mirror.c
+++ b/tests/qtest/test-filter-mirror.c
@@ -58,13 +58,13 @@ static void test_mirror(void)
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
close(send_sock[0]);
- ret = qemu_recv(recv_sock[0], &len, sizeof(len), 0);
+ ret = recv(recv_sock[0], &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
- ret = qemu_recv(recv_sock[0], recv_buf, len, 0);
+ ret = recv(recv_sock[0], recv_buf, len, 0);
g_assert_cmpstr(recv_buf, ==, send_buf);
g_free(recv_buf);
diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter-redirector.c
index 4f3f59cba8..fc16cf7e8d 100644
--- a/tests/qtest/test-filter-redirector.c
+++ b/tests/qtest/test-filter-redirector.c
@@ -115,13 +115,13 @@ static void test_redirector_tx(void)
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
close(backend_sock[0]);
- ret = qemu_recv(recv_sock, &len, sizeof(len), 0);
+ ret = recv(recv_sock, &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
- ret = qemu_recv(recv_sock, recv_buf, len, 0);
+ ret = recv(recv_sock, recv_buf, len, 0);
g_assert_cmpstr(recv_buf, ==, send_buf);
g_free(recv_buf);
@@ -182,13 +182,13 @@ static void test_redirector_rx(void)
ret = iov_send(send_sock, iov, 2, 0, sizeof(size) + sizeof(send_buf));
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
- ret = qemu_recv(backend_sock[0], &len, sizeof(len), 0);
+ ret = recv(backend_sock[0], &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
g_assert_cmpint(len, ==, sizeof(send_buf));
recv_buf = g_malloc(len);
- ret = qemu_recv(backend_sock[0], recv_buf, len, 0);
+ ret = recv(backend_sock[0], recv_buf, len, 0);
g_assert_cmpstr(recv_buf, ==, send_buf);
close(send_sock);
diff --git a/tests/qtest/virtio-net-test.c b/tests/qtest/virtio-net-test.c
index 8bf74e516c..a71395849f 100644
--- a/tests/qtest/virtio-net-test.c
+++ b/tests/qtest/virtio-net-test.c
@@ -87,11 +87,11 @@ static void tx_test(QVirtioDevice *dev,
QVIRTIO_NET_TIMEOUT_US);
guest_free(alloc, req_addr);
- ret = qemu_recv(socket, &len, sizeof(len), 0);
+ ret = recv(socket, &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
- ret = qemu_recv(socket, buffer, len, 0);
+ ret = recv(socket, buffer, len, 0);
g_assert_cmpstr(buffer, ==, "TEST");
}
@@ -202,11 +202,11 @@ static void announce_self(void *obj, void *data, QGuestAllocator *t_alloc)
qobject_unref(rsp);
/* Catch the first packet and make sure it's a RARP */
- ret = qemu_recv(sv[0], &len, sizeof(len), 0);
+ ret = recv(sv[0], &len, sizeof(len), 0);
g_assert_cmpint(ret, ==, sizeof(len));
len = ntohl(len);
- ret = qemu_recv(sv[0], buffer, len, 0);
+ ret = recv(sv[0], buffer, len, 0);
g_assert_cmpint(*proto, ==, htons(ETH_P_RARP));
/*
@@ -230,7 +230,7 @@ static void announce_self(void *obj, void *data, QGuestAllocator *t_alloc)
while (true) {
int saved_err;
- ret = qemu_recv(sv[0], buffer, 60, MSG_DONTWAIT);
+ ret = recv(sv[0], buffer, 60, MSG_DONTWAIT);
saved_err = errno;
now = g_get_monotonic_time();
g_assert_cmpint(now, <, deadline);
diff --git a/tests/unit/socket-helpers.c b/tests/unit/socket-helpers.c
index f704fd1a69..ef31664d02 100644
--- a/tests/unit/socket-helpers.c
+++ b/tests/unit/socket-helpers.c
@@ -105,7 +105,7 @@ static int socket_can_bind_connect(const char *hostname, int family)
}
if (check_soerr) {
- if (qemu_getsockopt(cfd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen) < 0) {
+ if (getsockopt(cfd, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen) < 0) {
goto cleanup;
}
if (soerr) {
diff --git a/util/osdep.c b/util/osdep.c
index 394804d32e..84575ec218 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -39,7 +39,7 @@ static const char *hw_version = QEMU_HW_VERSION;
int socket_set_cork(int fd, int v)
{
#if defined(SOL_TCP) && defined(TCP_CORK)
- return qemu_setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
+ return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
#else
return 0;
#endif
@@ -48,7 +48,7 @@ int socket_set_cork(int fd, int v)
int socket_set_nodelay(int fd)
{
int v = 1;
- return qemu_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
+ return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
}
int qemu_madvise(void *addr, size_t len, int advice)
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 0585e7a629..e8f45a7d30 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -97,7 +97,7 @@ bool fd_is_socket(int fd)
{
int optval;
socklen_t optlen = sizeof(optval);
- return !qemu_getsockopt(fd, SOL_SOCKET, SO_TYPE, &optval, &optlen);
+ return !getsockopt(fd, SOL_SOCKET, SO_TYPE, &optval, &optlen);
}
@@ -185,8 +185,8 @@ static int try_bind(int socket, InetSocketAddress *saddr, struct addrinfo *e)
rebind:
if (e->ai_family == PF_INET6) {
- qemu_setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
- sizeof(v6only));
+ setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
+ sizeof(v6only));
}
stat = bind(socket, e->ai_addr, e->ai_addrlen);
@@ -483,8 +483,8 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **errp)
if (saddr->keep_alive) {
int val = 1;
- int ret = qemu_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
- &val, sizeof(val));
+ int ret = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+ &val, sizeof(val));
if (ret < 0) {
error_setg_errno(errp, errno, "Unable to set KEEPALIVE");