From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y83qy-0007qP-Ld for qemu-devel@nongnu.org; Mon, 05 Jan 2015 04:21:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y83qu-0004To-Kr for qemu-devel@nongnu.org; Mon, 05 Jan 2015 04:21:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y83qu-0004Ta-Dl for qemu-devel@nongnu.org; Mon, 05 Jan 2015 04:21:32 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t059LUmq027061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 5 Jan 2015 04:21:31 -0500 From: Gal Hammer Date: Mon, 5 Jan 2015 11:21:03 +0200 Message-Id: <1420449663-4542-1-git-send-email-ghammer@redhat.com> Subject: [Qemu-devel] [PATCH] char: disable stdio echo on resume from suspend. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gal Hammer , Paolo Bonzini 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 --- 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