On Tue, Jan 17, 2012 at 1:33 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 01/17/2012 12:33 PM, Stefan Hajnoczi wrote: >> >> I was wondering about a qemu-side solution where a closed qtest socket >> means we need to shut down, but am not sure if the chardev code lets >> us do that. (Really we want POLLHUP but we only seem to have >> POLLIN/POLLOUT handlers.) > > > For poll, both POLLIN and POLLOUT are always reported together with POLLHUP. > I think the same happens with select(). If you get a zero-read in the > qtest chardev handler you can shut down.
There is already open/closed logic in qemu-char.c that acts on select(2) becoming readable. However, it isn't kicking in - we're still ending up in send_all(), which should only be called when we thing the socket is connected. I'll investigate some more. Stefan