aboutsummaryrefslogtreecommitdiff
path: root/slirp/misc.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/misc.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/misc.c')
-rw-r--r--slirp/misc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/slirp/misc.c b/slirp/misc.c
index b8a2bf971a..32ec02a525 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -72,14 +72,14 @@ slirp_socketpair_with_oob(int sv[2])
int ret, s;
sv[1] = -1;
- s = qemu_socket(AF_INET, SOCK_STREAM, 0);
+ s = slirp_socket(AF_INET, SOCK_STREAM, 0);
if (s < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 ||
listen(s, 1) < 0 ||
getsockname(s, (struct sockaddr *)&addr, &addrlen) < 0) {
goto err;
}
- sv[1] = qemu_socket(AF_INET, SOCK_STREAM, 0);
+ sv[1] = slirp_socket(AF_INET, SOCK_STREAM, 0);
if (sv[1] < 0) {
goto err;
}
@@ -102,16 +102,16 @@ slirp_socketpair_with_oob(int sv[2])
goto err;
}
- closesocket(s);
+ slirp_closesocket(s);
return 0;
err:
g_critical("slirp_socketpair(): %s", strerror(errno));
if (s >= 0) {
- closesocket(s);
+ slirp_closesocket(s);
}
if (sv[1] >= 0) {
- closesocket(sv[1]);
+ slirp_closesocket(sv[1]);
}
return -1;
}
@@ -153,16 +153,16 @@ fork_exec(struct socket *so, const char *ex)
if (err) {
g_critical("fork_exec: %s", err->message);
g_error_free(err);
- closesocket(sp[0]);
- closesocket(sp[1]);
+ slirp_closesocket(sp[0]);
+ slirp_closesocket(sp[1]);
return 0;
}
so->s = sp[0];
- closesocket(sp[1]);
- socket_set_fast_reuse(so->s);
+ slirp_closesocket(sp[1]);
+ slirp_socket_set_fast_reuse(so->s);
opt = 1;
- qemu_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
+ slirp_setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
qemu_set_nonblock(so->s);
return 1;
}