diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-03-22 01:02:52 +0100 |
---|---|---|
committer | Jan Kiszka <jan.kiszka@siemens.com> | 2012-03-28 20:33:26 +0200 |
commit | 1c5970a8b8ed79334e8ab303fec7287442538c3c (patch) | |
tree | 71ed4fd093bfe7986ac77cdff35ff417f611d350 /slirp/misc.c | |
parent | b72210568ef0c0fb141a01cffb71a09c4efa0364 (diff) |
slirp: use socket_set_nonblock
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Diffstat (limited to 'slirp/misc.c')
-rw-r--r-- | slirp/misc.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/slirp/misc.c b/slirp/misc.c index 0308a62fac..0bee864337 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -215,7 +215,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) setsockopt(so->s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int)); opt = 1; setsockopt(so->s, SOL_SOCKET, SO_OOBINLINE, (char *)&opt, sizeof(int)); - fd_nonblock(so->s); + socket_set_nonblock(so->s); /* Append the telnet options now */ if (so->so_m != NULL && do_pty == 1) { @@ -267,50 +267,6 @@ u_sleep(int usec) select(0, &fdset, &fdset, &fdset, &t); } -/* - * Set fd blocking and non-blocking - */ - -void -fd_nonblock(int fd) -{ -#ifdef FIONBIO -#ifdef _WIN32 - unsigned long opt = 1; -#else - int opt = 1; -#endif - - ioctlsocket(fd, FIONBIO, &opt); -#else - int opt; - - opt = fcntl(fd, F_GETFL, 0); - opt |= O_NONBLOCK; - fcntl(fd, F_SETFL, opt); -#endif -} - -void -fd_block(int fd) -{ -#ifdef FIONBIO -#ifdef _WIN32 - unsigned long opt = 0; -#else - int opt = 0; -#endif - - ioctlsocket(fd, FIONBIO, &opt); -#else - int opt; - - opt = fcntl(fd, F_GETFL, 0); - opt &= ~O_NONBLOCK; - fcntl(fd, F_SETFL, opt); -#endif -} - void slirp_connection_info(Slirp *slirp, Monitor *mon) { const char * const tcpstates[] = { |