From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KGcia-0001FJ-LK for qemu-devel@nongnu.org; Wed, 09 Jul 2008 12:40:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KGciZ-0001EH-3E for qemu-devel@nongnu.org; Wed, 09 Jul 2008 12:40:36 -0400 Received: from [199.232.76.173] (port=55460 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGciY-0001E7-Qb for qemu-devel@nongnu.org; Wed, 09 Jul 2008 12:40:34 -0400 Received: from mx20.gnu.org ([199.232.41.8]:48298) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KGbgf-0002Fk-Rr for qemu-devel@nongnu.org; Wed, 09 Jul 2008 11:34:34 -0400 Received: from mx1.redhat.com ([66.187.233.31]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KGZ1K-0002Y1-T8 for qemu-devel@nongnu.org; Wed, 09 Jul 2008 08:43:43 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m69CJMRl008588 for ; Wed, 9 Jul 2008 08:19:22 -0400 From: Gerd Hoffmann Date: Wed, 9 Jul 2008 14:19:18 +0200 Message-Id: <1215605958-22623-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1215605958-22623-1-git-send-email-kraxel@redhat.com> References: <1215605958-22623-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] open ptys in non-blocking mode. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Otherwise qemu will hang in case nobody connects to the pty and the guests prints enougth messages to fill up the buffer (which is 4k in linux). Downside is that data may get lost in case the reader is too slow. Ideally we could detect whenever someone is connected to the other end of the pseudo tty and write data only in connected mode (like it is done for tcp/telnet). I'm not aware of any way to accomplish that though. Signed-off-by: Gerd Hoffmann --- vl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/vl.c b/vl.c index 587b91c..adc8f5f 100644 --- a/vl.c +++ b/vl.c @@ -2468,6 +2468,7 @@ static CharDriverState *qemu_chr_open_pty(void) /* Set raw attributes on the pty. */ cfmakeraw(&tty); tcsetattr(slave_fd, TCSAFLUSH, &tty); + socket_set_nonblock(master_fd); fprintf(stderr, "char device redirected to %s\n", ptsname(master_fd)); return qemu_chr_open_fd(master_fd, master_fd); -- 1.5.4.1