qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] open ptys in non-blocking mode.


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH 2/2] open ptys in non-blocking mode.
Date: Wed, 9 Jul 2008 14:19:18 +0200

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 <address@hidden>
---
 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 via email to

[Prev in Thread] Current Thread [Next in Thread]