aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-04-02 14:07:35 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-02 14:07:35 -0500
commit162cbbd1736de2bca43fdefa7e98c54a361ee60d (patch)
treeb61fbd71c097e8f6447a785132fb12f973e73e24 /qemu-char.c
parent9d4563c415683e4d06c84a46e8d178a680fdcb7b (diff)
parent9b938c7262e403f5467110609cb20ef1ae6e9df2 (diff)
Merge remote-tracking branch 'luiz/queue/qmp' into staging
# By Stefan Hajnoczi # Via Luiz Capitulino * luiz/queue/qmp: chardev: clear O_NONBLOCK on SCM_RIGHTS file descriptors qemu-socket: set passed fd non-blocking in socket_connect() net: ensure "socket" backend uses non-blocking fds oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 7acbf53ef6..505a773330 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2444,6 +2444,9 @@ static void unix_process_msgfd(CharDriverState *chr, struct msghdr *msg)
if (fd < 0)
continue;
+ /* O_NONBLOCK is preserved across SCM_RIGHTS so reset it */
+ qemu_set_block(fd);
+
#ifndef MSG_CMSG_CLOEXEC
qemu_set_cloexec(fd);
#endif
@@ -2574,7 +2577,7 @@ static int tcp_chr_add_client(CharDriverState *chr, int fd)
if (s->fd != -1)
return -1;
- socket_set_nonblock(fd);
+ qemu_set_nonblock(fd);
if (s->do_nodelay)
socket_set_nodelay(fd);
s->fd = fd;
@@ -2726,7 +2729,7 @@ static CharDriverState *qemu_chr_open_socket_fd(int fd, bool do_nodelay,
printf("QEMU waiting for connection on: %s\n",
chr->filename);
tcp_chr_accept(s->listen_chan, G_IO_IN, chr);
- socket_set_nonblock(s->listen_fd);
+ qemu_set_nonblock(s->listen_fd);
}
return chr;
}
@@ -2768,7 +2771,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
}
if (!is_waitconnect)
- socket_set_nonblock(fd);
+ qemu_set_nonblock(fd);
chr = qemu_chr_open_socket_fd(fd, do_nodelay, is_listen, is_telnet,
is_waitconnect, &local_err);
@@ -3657,7 +3660,7 @@ static CharDriverState *qmp_chardev_open_serial(ChardevHostdev *serial,
if (error_is_set(errp)) {
return NULL;
}
- socket_set_nonblock(fd);
+ qemu_set_nonblock(fd);
return qemu_chr_open_tty_fd(fd);
#else
error_setg(errp, "character device backend type 'serial' not supported");