From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1DjA-00063v-O0 for qemu-devel@nongnu.org; Mon, 31 Oct 2016 10:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1Dj9-0003y6-U7 for qemu-devel@nongnu.org; Mon, 31 Oct 2016 10:38:20 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1Dj9-0003xk-Ml for qemu-devel@nongnu.org; Mon, 31 Oct 2016 10:38:19 -0400 Received: by mail-wm0-x242.google.com with SMTP id 68so11975112wmz.2 for ; Mon, 31 Oct 2016 07:38:19 -0700 (PDT) Received: from donizetti.lan (dynamic-adsl-78-12-246-178.clienti.tiscali.it. [78.12.246.178]) by smtp.gmail.com with ESMTPSA id r72sm25166766wmd.21.2016.10.31.07.38.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Oct 2016 07:38:17 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 31 Oct 2016 15:37:41 +0100 Message-Id: <1477924663-30950-26-git-send-email-pbonzini@redhat.com> In-Reply-To: <1477924663-30950-1-git-send-email-pbonzini@redhat.com> References: <1477924663-30950-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 25/27] qemu-char: do not forward events through the mux until QEMU has started List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Otherwise, the CHR_EVENT_OPENED event is sent twice: first when the backend (for example "stdio") is opened, and second after processing the command line. The incorrect sending of the event prints the monitor banner when QEMU is started with "-serial mon:stdio". This includes the "(qemu)" prompt; thus the monitor seems to be dead, whereas actually the active front-end is the serial port. Reported-by: Dr. David Alan Gilbert Tested-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- qemu-char.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 1e5a0e8..2c9940c 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -735,19 +735,23 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size) } } +static bool muxes_realized; + static void mux_chr_event(void *opaque, int event) { CharDriverState *chr = opaque; MuxDriver *d = chr->opaque; int i; + if (!muxes_realized) { + return; + } + /* Send the event to all registered listeners */ for (i = 0; i < d->mux_cnt; i++) mux_chr_send_event(d, i, event); } -static bool muxes_realized; - /** * Called after processing of default and command-line-specified * chardevs to deliver CHR_EVENT_OPENED events to any FEs attached -- 2.7.4