Commit 76b004d1 authored by Dr. David Alan Gilbert's avatar Dr. David Alan Gilbert Committed by Paolo Bonzini
Browse files

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: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 66d26ddb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
    }