From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JsQqh-0004Jk-9F for qemu-devel@nongnu.org; Sat, 03 May 2008 19:08:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JsQqg-0004IC-91 for qemu-devel@nongnu.org; Sat, 03 May 2008 19:08:58 -0400 Received: from [199.232.76.173] (port=56778 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JsQqg-0004I4-2z for qemu-devel@nongnu.org; Sat, 03 May 2008 19:08:58 -0400 Received: from hall.aurel32.net ([91.121.138.14]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JsQqf-0004uc-Pi for qemu-devel@nongnu.org; Sat, 03 May 2008 19:08:57 -0400 Date: Sun, 4 May 2008 01:08:50 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] PATCH: Put Psuedo-TTY in rawmode for char devices Message-ID: <20080503230850.GA6745@volta.aurel32.net> References: <20080422005057.GD3649@redhat.com> <20080501171424.GF21335@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20080501171424.GF21335@redhat.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org 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. -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net