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

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



Hello,

I was getting intermittent "Could not read tty from store" when creating
domains. This is because tools/console/daemon/io.c:domain_create_tty()
seems to expect openpty() to initiaze term, but it's the converse:
openpty expects to be given term parameters and doesn't touch it, so
that term mostly contains random data when given to tcsetattr, and thus
console creation failure. Here is a patch that fixes this.

Samuel

Use tcgetattr to fetch the initial terminal parameters in the console
daemon.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxx>

diff -r c005937f67d5 tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Mon Dec 17 10:55:33 2007 +0000
+++ b/tools/console/daemon/io.c Mon Dec 17 11:17:39 2007 +0000
@@ -282,7 +282,7 @@ static int domain_create_tty(struct doma
        char *data;
        unsigned int len;
 
-       if (openpty(&master, &slavefd, slave, &term, NULL) < 0) {
+       if (openpty(&master, &slavefd, slave, NULL, NULL) < 0) {
                master = -1;
                err = errno;
                dolog(LOG_ERR, "Failed to create tty for domain-%d (errno = %i, 
%s)",
@@ -290,10 +290,16 @@ static int domain_create_tty(struct doma
                return master;
        }
 
+       if (tcgetattr(master, &term) < 0) {
+               err = errno;
+               dolog(LOG_ERR, "Failed to get tty attribute for domain-%d 
(errno = %i, %s)",
+                     dom->domid, err, strerror(err));
+               goto out;
+       }
        cfmakeraw(&term);
        if (tcsetattr(master, TCSAFLUSH, &term) < 0) {
                err = errno;
-               dolog(LOG_ERR, "Failed to set tty attribute  for domain-%d 
(errno = %i, %s)",
+               dolog(LOG_ERR, "Failed to set tty attribute for domain-%d 
(errno = %i, %s)",
                      dom->domid, err, strerror(err));
                goto out;
        }

_______________________________________________
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®.