From: Dr. David Alan Gilbert Date: Mon, 26 Feb 2018 13:04:52 +0000 (+0000) Subject: serial: Open non-block X-Git-Tag: v3.0.0-rc0~34^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=76b004d10da09bb77a4343edf7b98b2d662fb4f2;p=thirdparty%2Fqemu.git 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 Signed-off-by: Paolo Bonzini --- diff --git a/chardev/char-serial.c b/chardev/char-serial.c index ae548d28da9..3299b468530 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; }