qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gal Hammer <ghammer@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gal Hammer <ghammer@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH] char: disable stdio echo on resume from suspend.
Date: Mon,  5 Jan 2015 11:21:03 +0200	[thread overview]
Message-ID: <1420449663-4542-1-git-send-email-ghammer@redhat.com> (raw)

The monitor's auto-completion feature stopped working when stdio is used
as an input and qemu was resumed after it was suspended (using ctrl-z).

Signed-off-by: Gal Hammer <ghammer@redhat.com>
---
 qemu-char.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/qemu-char.c b/qemu-char.c
index ef84b53..786df33 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1113,12 +1113,22 @@ static int old_fd0_flags;
 static bool stdio_in_use;
 static bool stdio_allow_signal;
 
+static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo);
+
 static void term_exit(void)
 {
     tcsetattr (0, TCSANOW, &oldtty);
     fcntl(0, F_SETFL, old_fd0_flags);
 }
 
+static void term_stdio_handler(int sig)
+{
+    if (sig == SIGCONT) {
+        /* echo should be off after resume from suspend. */
+        qemu_chr_set_echo_stdio(NULL, false);
+    }
+}
+
 static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo)
 {
     struct termios tty;
@@ -1165,6 +1175,7 @@ static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)
     tcgetattr(0, &oldtty);
     qemu_set_nonblock(0);
     atexit(term_exit);
+    signal(SIGCONT, term_stdio_handler);
 
     chr = qemu_chr_open_fd(0, 1);
     chr->chr_close = qemu_chr_close_stdio;
-- 
2.1.0

             reply	other threads:[~2015-01-05  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05  9:21 Gal Hammer [this message]
2015-01-06 13:33 ` [Qemu-devel] [PATCH] char: disable stdio echo on resume from suspend Marcel Apfelbaum
2015-01-06 13:49 ` Peter Maydell
2015-01-06 14:30   ` Gal Hammer
2015-01-06 14:36     ` Peter Maydell
2015-01-06 18:45       ` Gal Hammer

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=1420449663-4542-1-git-send-email-ghammer@redhat.com \
    --to=ghammer@redhat.com \
    --cc=pbonzini@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).