]> Git Repo - qemu.git/commitdiff
serial: Open non-block
authorDr. David Alan Gilbert <[email protected]>
Mon, 26 Feb 2018 13:04:52 +0000 (13:04 +0000)
committerPaolo Bonzini <[email protected]>
Mon, 2 Jul 2018 13:41:18 +0000 (15:41 +0200)
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 <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
chardev/char-serial.c

index ae548d28da954de983502bab0a8e441ae4163851..3299b4685307f8048c0d78e8f58633c26ecdc1e0 100644 (file)
@@ -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;
     }
This page took 0.02673 seconds and 4 git commands to generate.