aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-01-16 13:44:18 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-01-16 13:44:18 +0000
commit889be060b83e4b5800ef11a191e26f908ffd046a (patch)
tree27510a9cad789f623a6257d9bc6c20111ac9e21a /tools/console
parent3c2d0242e4b497a9b9d514cbf7625460e0a5167c (diff)
downloadxen-889be060b83e4b5800ef11a191e26f908ffd046a.tar.gz
xen-889be060b83e4b5800ef11a191e26f908ffd046a.tar.bz2
xen-889be060b83e4b5800ef11a191e26f908ffd046a.zip
xenconsoled: Make slave pty raw during initialization.
(This avoids echo). Signed-off-by: Tristan Gingold <tgingold@free.fr>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/daemon/io.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index b0c0f492fa..735a77b0e6 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -246,7 +246,6 @@ static void domain_close_tty(struct domain *dom)
}
#ifdef __sun__
-/* Once Solaris has openpty(), this is going to be removed. */
static int openpty(int *amaster, int *aslave, char *name,
struct termios *termp, struct winsize *winp)
{
@@ -278,8 +277,10 @@ static int openpty(int *amaster, int *aslave, char *name,
if (winp)
ioctl(sfd, TIOCSWINSZ, winp);
+ if (termp)
+ tcsetattr(sfd, TCSAFLUSH, termp);
+
assert(name == NULL);
- assert(termp == NULL);
return 0;
@@ -289,7 +290,20 @@ err:
close(mfd);
return -1;
}
-#endif
+
+void cfmakeraw(struct termios *termios_p)
+{
+ termios_p->c_iflag &=
+ ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ termios_p->c_oflag &= ~OPOST;
+ termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ termios_p->c_cflag &= ~(CSIZE|PARENB);
+ termios_p->c_cflag |= CS8;
+
+ termios_p->c_cc[VMIN] = 0;
+ termios_p->c_cc[VTIME] = 0;
+}
+#endif /* __sun__ */
static int domain_create_tty(struct domain *dom)
{
@@ -299,11 +313,14 @@ static int domain_create_tty(struct domain *dom)
bool success;
char *data;
unsigned int len;
+ struct termios term;
assert(dom->slave_fd == -1);
assert(dom->master_fd == -1);
- if (openpty(&dom->master_fd, &dom->slave_fd, NULL, NULL, NULL) < 0) {
+ cfmakeraw(&term);
+
+ if (openpty(&dom->master_fd, &dom->slave_fd, NULL, &term, NULL) < 0) {
err = errno;
dolog(LOG_ERR, "Failed to create tty for domain-%d (errno = %i, %s)",
dom->domid, err, strerror(err));