WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "Yu, Ping Y" <ping.y.yu@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH]fix VMX "xm console" issue
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Wed, 30 Nov 2005 08:52:08 -0600
Cc: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Daniel Stekloff <dsteklof@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 30 Nov 2005 14:52:11 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <9DE394C12A921946AEECE1F71944ECD5024E33FF@pdsmsx404>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <9DE394C12A921946AEECE1F71944ECD5024E33FF@pdsmsx404>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)
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