Re: [PATCH 7/7] virtio: console: Return -EPIPE if port on the host isn't connected

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

 



On (Tue) Mar 23 2010 [11:00:23], Michael S. Tsirkin wrote:
> On Tue, Mar 23, 2010 at 02:28:00PM +0530, Amit Shah wrote:
> > The virtio-serial ports are like pipes, if there's no reader on the
> > other end, sending data might get it either ignored or the host might
> > return '0', which would make guests get -EAGAIN. Since we know the state
> > of the host port connection, it's appropriate to let the application
> > know that the other end isn't connected.
> > 
> > Signed-off-by: Amit Shah <amit.shah@xxxxxxxxxx>
> > ---
> >  drivers/char/virtio_console.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> > index 55de0b5..4562964 100644
> > --- a/drivers/char/virtio_console.c
> > +++ b/drivers/char/virtio_console.c
> > @@ -411,6 +411,9 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count)
> >  	ssize_t ret;
> >  	unsigned int len;
> >  
> > +	if (use_multiport(port->portdev) && !port->host_connected)
> > +		return -EPIPE;
> > +
> 
> Hmm, do applications actually handle this error?

Don't know; there aren't any apps yet that use this functionality too.
However, some error has to be indicated to the app otherwise it's just
messy if the app keeps writing and receiving EAGAIN; we just get a tight
loop in this case.

		Amit
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux