WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Fix xenconsole's "Could not read tty from store"
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Mon, 17 Dec 2007 11:22:54 +0000
Delivery-date: Mon, 17 Dec 2007 03:24:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
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