ia64/xen-unstable
changeset 8134:590915af8117
Fix serial pty creation in qemu-dm. Set raw attributes to
avoid weird buffering behaviour and obtain the pty name
via ptsname().
Signed-off-by: Ping Yu <ping.y.yu@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
avoid weird buffering behaviour and obtain the pty name
via ptsname().
Signed-off-by: Ping Yu <ping.y.yu@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Wed Nov 30 12:32:16 2005 +0100 (2005-11-30) |
parents | 73d19afe543c |
children | 37c09b20a896 f4c57a520424 |
files | tools/ioemu/vl.c |
line diff
1.1 --- a/tools/ioemu/vl.c Wed Nov 30 12:16:35 2005 +0100 1.2 +++ b/tools/ioemu/vl.c Wed Nov 30 12:32:16 2005 +0100 1.3 @@ -1176,7 +1176,6 @@ CharDriverState *qemu_chr_open_stdio(voi 1.4 int store_console_dev(int domid, char *pts) 1.5 { 1.6 int xc_handle; 1.7 - unsigned int len = 0; 1.8 struct xs_handle *xs; 1.9 char *path; 1.10 1.11 @@ -1218,15 +1217,19 @@ int store_console_dev(int domid, char *p 1.12 #if defined(__linux__) 1.13 CharDriverState *qemu_chr_open_pty(void) 1.14 { 1.15 - char slave_name[1024]; 1.16 int master_fd, slave_fd; 1.17 - 1.18 - /* Not satisfying */ 1.19 - if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) { 1.20 + struct termios term; 1.21 + 1.22 + if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) < 0) 1.23 return NULL; 1.24 - } 1.25 - fprintf(stderr, "char device redirected to %s\n", slave_name); 1.26 - store_console_dev(domid, slave_name); 1.27 + 1.28 + /* Set raw attributes on the pty. */ 1.29 + cfmakeraw(&term); 1.30 + tcsetattr(slave_fd, TCSAFLUSH, &term); 1.31 + 1.32 + fprintf(stderr, "char device redirected to %s\n", ptsname(slave_fd)); 1.33 + store_console_dev(domid, ptsname(slave_fd)); 1.34 + 1.35 return qemu_chr_open_fd(master_fd, master_fd); 1.36 } 1.37 #else