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

Re: [Xen-devel] [PATCH]fix VMX "xm console" issue



Yu, Ping Y wrote:

Looking at the qemu code to create a PTY device, it's not quite optimal.

For instance, it's not suggested that you pass a name parameter to
openpty() b/c it's unclear what's a safe size of the buffer.  Instead,
ptsname() should be called on the slave fd.
This is true. Maybe a small patch is needed.
I think the right fix is to tcsetattr() a cfmakeraw() on the slave PTY
fd after openpty() is called in vl.c.  Otherwise, it's quite possible
(and likely) to get strange buffering behavior depending on the terminal
attributes that are inherited when ioemu is spawned.
You are right. Currently, there is no control for VMX pty. Following your direction I made a patch and it sounds OK in testing.

diff -r eb1169f92d81 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Sun Nov 27 13:09:46 2005
+++ b/tools/ioemu/vl.c  Wed Nov 30 19:16:34 2005
@@ -1218,15 +1218,20 @@
#if defined(__linux__)
CharDriverState *qemu_chr_open_pty(void)
{
-    char slave_name[1024];
+    char *slave_name;
    int master_fd, slave_fd;
+    struct termios term;

    /* Not satisfying */
-    if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
+    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 attritrute */
+    cfmakeraw(&term);
+    tcsetattr(slave_fd, TCSAFLUSH, &term);
+    store_console_dev(domid, ptsname(slave_fd));
    return qemu_chr_open_fd(master_fd, master_fd);
}
#else
Excellent!  Looks good to me.

Regards,

Anthony Liguori

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


 


Rackspace

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