[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] Always use nonblocking mode for qemu_chr_op

From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 2/3] Always use nonblocking mode for qemu_chr_open_fd.
Date: Thu, 24 Jul 2008 09:24:24 +0200
User-agent: Thunderbird (X11/20080501)

Jamie Lokier wrote:
> As fas as I know, the usual way to use ptys is a program opens the
> pty/tty pair, then it forks/execs a process which will use the tty
> half.  The child might be the one to open the tty, but it is still
> done so the parent knows the tty is open before it tries to use the
> pty.

Yep, that is what they are designed for (i.e. terminal emulators like
screen or xterm keep the pty and hand over the tty to the shell or
whatever process they are going to run in the virtual terminal).

> To create a pty, and wait without polling for another process to
> connect to the tty, this might work:
>     1. Open the pty and tty _pair_, in the usual way.

[ ... cut ... ]

That would work for the monitor.

The problematic corner case are virtual serial lines though.  If nobody
is connected we don't want to send out data (pretty much like a
unconnected socket), so we don't block forever once the output buffer is
full.  If somebody is listening we want him get all the data (and
eventually block in case the reader is slow).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]