aboutsummaryrefslogtreecommitdiff
path: root/slirp/socket.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-17 15:43:40 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-07 15:49:08 +0200
commit707bd47ef3cf778b691d9e0df2ede3ec4c3fe771 (patch)
treee24e8b1c331a0acd7084d8edcb00b779598b7e2b /slirp/socket.c
parent90329416405f6660a6f54592f70850c2917f8148 (diff)
slirp: replace most qemu socket utilities with slirp own version
qemu_set_nonblock() is slightly more problematic and will be dealt with in a separate patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/socket.c')
-rw-r--r--slirp/socket.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/slirp/socket.c b/slirp/socket.c
index 5ffbaa064a..5805d30f3d 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -187,7 +187,7 @@ soread(struct socket *so)
*/
sopreprbuf(so, iov, &n);
- nn = qemu_recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
+ nn = slirp_recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
if (nn <= 0) {
if (nn < 0 && (errno == EINTR || errno == EAGAIN))
return 0;
@@ -203,7 +203,7 @@ soread(struct socket *so)
if (getpeername(so->s, paddr, &alen) < 0) {
err = errno;
} else {
- getsockopt(so->s, SOL_SOCKET, SO_ERROR,
+ slirp_getsockopt(so->s, SOL_SOCKET, SO_ERROR,
&err, &elen);
}
}
@@ -233,7 +233,7 @@ soread(struct socket *so)
*/
if (n == 2 && nn == iov[0].iov_len) {
int ret;
- ret = qemu_recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
+ ret = slirp_recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
if (ret > 0)
nn += ret;
}
@@ -554,7 +554,7 @@ sorecvfrom(struct socket *so)
*/
len = M_FREEROOM(m);
/* if (so->so_fport != htons(53)) { */
- ioctlsocket(so->s, FIONREAD, &n);
+ slirp_ioctlsocket(so->s, FIONREAD, &n);
if (n > len) {
n = (m->m_data - m->m_dat) + m->m_len + n + 1;
@@ -719,14 +719,14 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
addr.sin_addr.s_addr = haddr;
addr.sin_port = hport;
- if (((s = qemu_socket(AF_INET,SOCK_STREAM,0)) < 0) ||
- (socket_set_fast_reuse(s) < 0) ||
+ if (((s = slirp_socket(AF_INET,SOCK_STREAM,0)) < 0) ||
+ (slirp_socket_set_fast_reuse(s) < 0) ||
(bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
(listen(s,1) < 0)) {
int tmperrno = errno; /* Don't clobber the real reason we failed */
if (s >= 0) {
- closesocket(s);
+ slirp_closesocket(s);
}
sofree(so);
/* Restore the real errno */
@@ -737,9 +737,9 @@ tcp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,
#endif
return NULL;
}
- qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
+ slirp_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
opt = 1;
- qemu_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(int));
+ slirp_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(int));
getsockname(s,(struct sockaddr *)&addr,&addrlen);
so->so_ffamily = AF_INET;