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: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH 2/3] Always use nonblocking mode for qemu_chr_open_fd.
Date: Wed, 23 Jul 2008 13:15:10 +0100
User-agent: Mutt/1.4.1i

On Wed, Jul 23, 2008 at 01:48:14PM +0200, Gerd Hoffmann wrote:
> Daniel P. Berrange wrote:
> 
> > In the case of the PTY backend, the only time I'd expect data to be dropped
> > is if there was no active slave open. If an application has the PTY open
> > and is interacting, then I'd want to get all data.  
> 
> Yep, that would be most useful (and also matches what is done for tcp
> for example).  Now the interesting question is:  How can qemu figure (in
> a portable way) whenever there is some process listening on the slave side?

Well you get SIGHUP when the slave side closes, but the problem is then
detecting the re-connect. If you keep polling on the master PTY you'll just
spin getting SIGHUP all the time. On Linux you can deal with this by using
epoll() in edge-triggered mode instead of poll which is level-triggered.
Unfortunately epoll is Linux specific, so you'd need to have alternate
impls of the guts of the QEMU event loop for every OS :-(

According to epoll(2), on FreeBSD you can use kqueue and on Solaris
you can use /dev/poll. The PTY code isn't supported on Windows so
that wouldn't neccessarily be a show stopper.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




reply via email to

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