All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: "Yu, Ping Y" <ping.y.yu@intel.com>
Cc: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>,
	Daniel Stekloff <dsteklof@us.ibm.com>,
	xen-devel@lists.xensource.com
Subject: Re: [PATCH]fix VMX "xm console" issue
Date: Wed, 30 Nov 2005 08:52:08 -0600	[thread overview]
Message-ID: <438DBC98.8020101@us.ibm.com> (raw)
In-Reply-To: <9DE394C12A921946AEECE1F71944ECD5024E33FF@pdsmsx404>

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

  reply	other threads:[~2005-11-30 14:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 11:18 [PATCH]fix VMX "xm console" issue Yu, Ping Y
2005-11-30 14:52 ` Anthony Liguori [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-12-02  7:08 Yu, Ping Y
2005-11-30 11:20 Ian Pratt
2005-11-30 11:09 Yu, Ping Y
2005-11-30  2:00 Yu, Ping Y
2005-11-29 11:51 Ian Pratt
2005-11-29 14:10 ` Anthony Liguori
2005-11-29 14:51   ` Daniel Stekloff
2005-11-29 15:03     ` Anthony Liguori
2005-11-29 11:24 Yu, Ping Y
2005-11-29 11:19 Yu, Ping Y
2005-11-29 10:14 Ian Pratt
2005-11-29  3:03 Yu, Ping Y

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438DBC98.8020101@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=dsteklof@us.ibm.com \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=ping.y.yu@intel.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.