qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] open ptys in non-blocking mode.
Date: Wed,  9 Jul 2008 14:19:18 +0200	[thread overview]
Message-ID: <1215605958-22623-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1215605958-22623-1-git-send-email-kraxel@redhat.com>

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 <kraxel@redhat.com>
---
 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

  reply	other threads:[~2008-07-09 16:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09 12:19 [Qemu-devel] [PATCH 1/2] unix_write: don't block on non-blocking file handles Gerd Hoffmann
2008-07-09 12:19 ` Gerd Hoffmann [this message]
2008-07-18  8:41   ` [Qemu-devel] [PATCH 2/2] open ptys in non-blocking mode Kevin Wolf
2008-07-18  9:10     ` Gerd Hoffmann
2008-07-18  9:14       ` Kevin Wolf
2008-07-18 13:56     ` Ian Jackson
2008-07-18 13:47   ` Ian Jackson
2008-07-18 13:46 ` [Qemu-devel] [PATCH 1/2] unix_write: don't block on non-blocking file handles Ian Jackson

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=1215605958-22623-2-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).