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

Re: [Xen-devel] [PATCH] Fix xenconsole's "Could not read tty from store"



On Tue, Dec 18, 2007 at 05:03:59PM +0000, Samuel Thibault wrote:

> Oops, there may be a problem with this:
> 
> John Levon, le Tue 18 Dec 2007 01:41:44 +0000, a écrit :
> > @@ -684,7 +720,9 @@ static void handle_tty_read(struct domai
> >             len = sizeof(msg);
> >  
> >     len = read(dom->tty_fd, msg, len);
> > -   if (len < 1) {
> > +   if (len == 0) {
> > +           /* slave did a close: that's fine. */
> > +   } else if (len < 0) {
> >             close(dom->tty_fd);
> >             dom->tty_fd = -1;
> >  
> 
> If the slave did a close, you have to somehow remove the fd from the
> select, because else you'll loop trying to read EOF.

Not on Solaris:

$ ./pty
terminal is /dev/pts/35
select returned
got 0 read: slave was closed
<waits>

See attached pty.c. On Linux I get:

$ ./pty
terminal is /dev/pts/9
select returned
read of master: -1 5
select returned
read of master: -1 5
select returned
...

It looks like we must keep the slave fd open on both platforms instead,
as Linux's behaviour if we close the slave is unusable. Do you agree?

regards
john

Attachment: pty.c
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.