qemu-devel
[Top][All Lists]
Advanced

[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: Mon, 28 Jul 2008 10:49:59 +0200
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Jamie Lokier wrote:
> Gerd Hoffmann wrote:
>> Fundamental problem is there is no easy way to figure whenever we are
>> connected or not.  Well, detecting the "connected -> disconnected"
>> transition is easy, as read() starts giving us -EIO then.  The
>> problematic case is the "(initial state | disconnected) ->
>> (re-)connected" transition.  We have to try read() now and then to check
>> whenever we still get -EIO or not.
> 
> Btw, I've just tested.  In the initial state, the tty side never
> opened, read() blocks and poll/select report that it's not ready for
> read.

You still don't know whenever someone is connected or not.  And thus you
still don't know whenever the stuff you write to the tty is read out by
someone or you risk to block when the kernel buffer is full.

Also note that openpty() which is used by qemu gives you an open file
handle for the tty side, so there is no "tty never opened" state.

cheers,
  Gerd

-- 
http://kraxel.fedorapeople.org/xenner/




reply via email to

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