All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix xenconsole's "Could not read tty from store"
@ 2007-12-17 11:22 Samuel Thibault
  2007-12-17 16:42 ` John Levon
  2007-12-18 20:41 ` VT-d and the GPU Philip Kufeldt
  0 siblings, 2 replies; 26+ messages in thread
From: Samuel Thibault @ 2007-12-17 11:22 UTC (permalink / raw)
  To: xen-devel

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@citrix.com>

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;
 	}

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2007-12-19 13:26 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-17 11:22 [PATCH] Fix xenconsole's "Could not read tty from store" Samuel Thibault
2007-12-17 16:42 ` John Levon
2007-12-17 16:54   ` Samuel Thibault
2007-12-18  1:41     ` John Levon
2007-12-18 11:57       ` Samuel Thibault
2007-12-18 13:35       ` John Levon
2007-12-18 17:43         ` Samuel Thibault
2007-12-18 17:03       ` Samuel Thibault
2007-12-18 18:01         ` John Levon
2007-12-18 18:07   ` Samuel Thibault
2007-12-18 18:13     ` John Levon
2007-12-18 18:18       ` Samuel Thibault
2007-12-18 18:24         ` John Levon
2007-12-18 18:47           ` Samuel Thibault
2007-12-18 18:48             ` Samuel Thibault
2007-12-18 18:55             ` John Levon
2007-12-19 11:39               ` Samuel Thibault
2007-12-18 18:52         ` John Levon
2007-12-18 19:00           ` Samuel Thibault
2007-12-18 19:18             ` John Levon
2007-12-19 11:35               ` Samuel Thibault
2007-12-19 11:29           ` Keir Fraser
2007-12-19 11:36             ` Samuel Thibault
2007-12-19 12:00           ` Samuel Thibault
2007-12-19 13:26             ` John Levon
2007-12-18 20:41 ` VT-d and the GPU Philip Kufeldt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.