debuggers.hg
changeset 16764:ec3f90599ab1
xenconsoled: Make slave pty raw during initialization.
(This avoids echo).
Signed-off-by: Tristan Gingold <tgingold@free.fr>
(This avoids echo).
Signed-off-by: Tristan Gingold <tgingold@free.fr>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Wed Jan 16 13:44:18 2008 +0000 (2008-01-16) |
parents | 847bc9b19c48 |
children | f17b34df974f |
files | tools/console/daemon/io.c |
line diff
1.1 --- a/tools/console/daemon/io.c Wed Jan 16 13:27:59 2008 +0000 1.2 +++ b/tools/console/daemon/io.c Wed Jan 16 13:44:18 2008 +0000 1.3 @@ -246,7 +246,6 @@ static void domain_close_tty(struct doma 1.4 } 1.5 1.6 #ifdef __sun__ 1.7 -/* Once Solaris has openpty(), this is going to be removed. */ 1.8 static int openpty(int *amaster, int *aslave, char *name, 1.9 struct termios *termp, struct winsize *winp) 1.10 { 1.11 @@ -278,8 +277,10 @@ static int openpty(int *amaster, int *as 1.12 if (winp) 1.13 ioctl(sfd, TIOCSWINSZ, winp); 1.14 1.15 + if (termp) 1.16 + tcsetattr(sfd, TCSAFLUSH, termp); 1.17 + 1.18 assert(name == NULL); 1.19 - assert(termp == NULL); 1.20 1.21 return 0; 1.22 1.23 @@ -289,7 +290,20 @@ err: 1.24 close(mfd); 1.25 return -1; 1.26 } 1.27 -#endif 1.28 + 1.29 +void cfmakeraw(struct termios *termios_p) 1.30 +{ 1.31 + termios_p->c_iflag &= 1.32 + ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); 1.33 + termios_p->c_oflag &= ~OPOST; 1.34 + termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); 1.35 + termios_p->c_cflag &= ~(CSIZE|PARENB); 1.36 + termios_p->c_cflag |= CS8; 1.37 + 1.38 + termios_p->c_cc[VMIN] = 0; 1.39 + termios_p->c_cc[VTIME] = 0; 1.40 +} 1.41 +#endif /* __sun__ */ 1.42 1.43 static int domain_create_tty(struct domain *dom) 1.44 { 1.45 @@ -299,11 +313,14 @@ static int domain_create_tty(struct doma 1.46 bool success; 1.47 char *data; 1.48 unsigned int len; 1.49 + struct termios term; 1.50 1.51 assert(dom->slave_fd == -1); 1.52 assert(dom->master_fd == -1); 1.53 1.54 - if (openpty(&dom->master_fd, &dom->slave_fd, NULL, NULL, NULL) < 0) { 1.55 + cfmakeraw(&term); 1.56 + 1.57 + if (openpty(&dom->master_fd, &dom->slave_fd, NULL, &term, NULL) < 0) { 1.58 err = errno; 1.59 dolog(LOG_ERR, "Failed to create tty for domain-%d (errno = %i, %s)", 1.60 dom->domid, err, strerror(err));