pkgsrc/sysutils/xentools3/patches/patch-ca
bouyer 2cfeee172d On NetBSD, the pseudo-tty attributes are reset when the slave is open
for the first time. This cause a race between xenconsole and xenconsoled,
where the later start writing to the master pty before the former has
switched it back to raw, causing some lines to be echoed back to the
domU.
Fix this by keeping the slave open in xenconsoled, so that when xenconsole
opens it attributes are not reset. Hint provided by fvdl@, thanks !
Because of this we no longer need to set the slave to raw in xenconsole,
so shorten patch-cc.

Bump PKGREVISION.
2008-03-08 13:59:39 +00:00

57 lines
1.3 KiB
Text

$NetBSD: patch-ca,v 1.1 2008/03/08 13:59:39 bouyer Exp $
--- console/daemon/io.c.orig 2008-03-08 14:24:52.000000000 +0100
+++ console/daemon/io.c 2008-03-08 14:41:23.000000000 +0100
@@ -56,6 +56,7 @@
{
int domid;
int tty_fd;
+ int stty_fd;
bool is_dead;
struct buffer buffer;
struct domain *next;
@@ -160,6 +161,12 @@
char *data;
unsigned int len;
+ if ((dom->stty_fd = open(slave, O_RDONLY, 0)) == -1) {
+ dolog(LOG_ERR, "Failed to open slave tty %s for "
+ "domain-%d", slave, dom->domid);
+ goto out;
+ }
+
if (tcgetattr(master, &term) != -1) {
cfmakeraw(&term);
tcsetattr(master, TCSAFLUSH, &term);
@@ -444,6 +451,7 @@
{
if (d->tty_fd != -1) {
close(d->tty_fd);
+ close(d->stty_fd);
d->tty_fd = -1;
}
@@ -527,6 +535,7 @@
len = read(dom->tty_fd, msg, len);
if (len < 1) {
close(dom->tty_fd);
+ close(dom->stty_fd);
dom->tty_fd = -1;
if (domain_is_valid(dom->domid)) {
@@ -545,6 +554,7 @@
xc_evtchn_notify(dom->xce_handle, dom->local_port);
} else {
close(dom->tty_fd);
+ close(dom->stty_fd);
dom->tty_fd = -1;
shutdown_domain(dom);
}
@@ -564,6 +574,7 @@
dom->domid, len, errno);
close(dom->tty_fd);
+ close(dom->stty_fd);
dom->tty_fd = -1;
if (domain_is_valid(dom->domid)) {