Aurelien Jarno, le Sun 04 May 2008 01:08:50 +0200, a écrit : > On Thu, May 01, 2008 at 06:14:24PM +0100, Daniel P. Berrange wrote: > > Re-posting patch for review/inclusion... > > > > On Tue, Apr 22, 2008 at 01:50:57AM +0100, Daniel P. Berrange wrote: > > > If running a QEMU instance with a serial/parallel device connected to a > > > Psuedo-TTY, eg '-serial pty', every \r\n sequence output by the guest > > > is getting translated into a \n\n sequence by the TTY layer. So clients > > > interacting with the serial port via a TTY done get the correct \r\n > > > sequence and text marches to the right and wraps. This is because the > > > TTY is not put into rawmode when QEMU sets it up. > > > > > > The following patch is a re-diff of a patch applied to Xen's QEMU code. > > > It uses cfmakeraw() to ensure the TTY is put into rawmode, thus avoiding > > > the incorrect \r\n translations. It also switches to tcsetattr() on the > > > slave_fd instead of master_fd - although this is effectively the same on > > > Linux, only slave_fd works on Solaris. Finally it stops using the 'name' > > > arg to openpty() which is a security risk because its buffer size is > > > undefined. Instead it makes use of the ptsname() function. > > > > cfmakeraw() is Linux specific, though also available on most BSD > systems. It is unavailable on Solaris, and probably the same on WIN32. Indeed, in Xen we keep a local definition of cfmakeraw for the solaris case. That being said, the same lines as term_init could be added, see attached patch. Samuel