diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-01-17 15:43:41 +0400 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-02-07 15:49:08 +0200 |
commit | 848c7092ba69318e7bc72a9c0c1f6cd443c439ad (patch) | |
tree | a5f4a80e8be467676ce6d8dce38dc4dc6669bf8d /slirp/util.c | |
parent | 707bd47ef3cf778b691d9e0df2ede3ec4c3fe771 (diff) |
slirp: replace qemu_set_nonblock()
Replace qemu_set_nonblock() with slirp_set_nonblock()
qemu_set_nonblock() does some event registration with the main
loop. Add a new callback register_poll_fd() for that reason.
Always build the fd-register stub, to avoid #if WIN32.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/util.c')
-rw-r--r-- | slirp/util.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/slirp/util.c b/slirp/util.c index b1a36b27bc..59f6713c8b 100644 --- a/slirp/util.c +++ b/slirp/util.c @@ -43,6 +43,20 @@ int inet_aton(const char *cp, struct in_addr *ia) } #endif +void slirp_set_nonblock(int fd) +{ +#ifndef _WIN32 + int f; + f = fcntl(fd, F_GETFL); + assert(f != -1); + f = fcntl(fd, F_SETFL, f | O_NONBLOCK); + assert(f != -1); +#else + unsigned long opt = 1; + ioctlsocket(fd, FIONBIO, &opt); +#endif +} + static void slirp_set_cloexec(int fd) { #ifndef _WIN32 |