From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH]fix VMX "xm console" issue Date: Wed, 30 Nov 2005 08:52:08 -0600 Message-ID: <438DBC98.8020101@us.ibm.com> References: <9DE394C12A921946AEECE1F71944ECD5024E33FF@pdsmsx404> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <9DE394C12A921946AEECE1F71944ECD5024E33FF@pdsmsx404> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Yu, Ping Y" Cc: Ian Pratt , Daniel Stekloff , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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