aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2018-02-26 13:04:52 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2018-07-02 15:41:18 +0200
commit76b004d10da09bb77a4343edf7b98b2d662fb4f2 (patch)
treeb5fa2752233f9445b8d9b3a369c16d347feaec7c
parent66d26ddb235439c72ff2b5fc0b42e242a57ba315 (diff)
downloadqemu-76b004d10da09bb77a4343edf7b98b2d662fb4f2.zip
qemu-76b004d10da09bb77a4343edf7b98b2d662fb4f2.tar.gz
qemu-76b004d10da09bb77a4343edf7b98b2d662fb4f2.tar.bz2
serial: Open non-block
On a real serial device, the open can block if the handshake lines are in a particular state. If a QEMU is passing the serial device to the guest, the QEMU startup is blocked opening the device (with a symptom seen as a timeout from libvirt). Open the serial port with O_NONBLOCK. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--chardev/char-serial.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chardev/char-serial.c b/chardev/char-serial.c
index ae548d2..3299b46 100644
--- a/chardev/char-serial.c
+++ b/chardev/char-serial.c
@@ -265,7 +265,8 @@ static void qmp_chardev_open_serial(Chardev *chr,
ChardevHostdev *serial = backend->u.serial.data;
int fd;
- fd = qmp_chardev_open_file_source(serial->device, O_RDWR, errp);
+ fd = qmp_chardev_open_file_source(serial->device, O_RDWR | O_NONBLOCK,
+ errp);
if (fd < 0) {
return;
}