[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix serial pty creation in qemu-dm. Set raw attributes to



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 590915af81172ecaeab2f7fdcd640eb41aa89456
# Parent  73d19afe543c271ec61169a224b007537b4be4cd
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@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 73d19afe543c -r 590915af8117 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Wed Nov 30 11:16:35 2005
+++ b/tools/ioemu/vl.c  Wed Nov 30 11:32:16 2005
@@ -1176,7 +1176,6 @@
 int store_console_dev(int domid, char *pts)
 {
     int xc_handle;
-    unsigned int len = 0;
     struct xs_handle *xs;
     char *path;
 
@@ -1218,15 +1217,19 @@
 #if defined(__linux__)
 CharDriverState *qemu_chr_open_pty(void)
 {
-    char slave_name[1024];
     int master_fd, slave_fd;
-
-    /* Not satisfying */
-    if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
+    struct termios term;
+
+    if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) < 0)
         return NULL;
-    }
-    fprintf(stderr, "char device redirected to %s\n", slave_name);
-    store_console_dev(domid, slave_name);
+
+    /* Set raw attributes on the pty. */
+    cfmakeraw(&term);
+    tcsetattr(slave_fd, TCSAFLUSH, &term);
+
+    fprintf(stderr, "char device redirected to %s\n", ptsname(slave_fd));
+    store_console_dev(domid, ptsname(slave_fd));
+
     return qemu_chr_open_fd(master_fd, master_fd);
 }
 #else

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.