Attempt to detect unconnected ptys (Gerd Hoffman)
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 28 Jul 2008 18:55:32 +0000 (18:55 +0000)
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 28 Jul 2008 18:55:32 +0000 (18:55 +0000)
commit279e694bc7bae106dc1178e7fbb60dfb832396e7
tree712f72d4b40f8b1c59eb101cb6ca09ee85f960d7
parent4a40e23194e6a6f6d4f8e7f0189e2cde2c0e517f
Attempt to detect unconnected ptys (Gerd Hoffman)

This patch moves the pty char device imlementation away from the generic
filehandle code.  It tries to detect as good as possible whenever there
is someone connected to the slave pty device and only send data down the
road in case someone is listening.  Unfortunaly we have to poll via
timer once in a while to check the status because we have to use read()
on the master pty to figure the status (returns -EIO when unconnected).

Poll intervall for an idle guest is one second, when the guest sends
data to the virtual device linked to the pty we check more frequently.

The point for all of this is to avoid qemu blocking and not responding
any more.  Writing to the master pty handle succeeds even when nobody is
connected to (and reading from) to the slave end of the pty.  The kernel
just bufferes the writes.  And as soon as the kernel buffer is full the
write() call blocks forever ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4956 c046a42c-6fe2-441c-8c8c-71466251a162
vl.c