From nobody Tue May 14 22:36:03 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669016233; cv=none; d=zohomail.com; s=zohoarc; b=ER36dUDPI1BdLBcXcESGBFj0P65L6oTy4p//Xb2TJM/JJvd3F0BCwBgrHYt2Q5tdn8RXCHuDLqEYd/KDFm8upcBrvRSsDQGO3eqnqnMYPVNB6LkOrdJbMTMnaRd6tpjPABj3iuH3M5TE5NVyhgJO1bhJshBfRKJCZw+aqwXyZWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669016233; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HWjes4iTCkN/Q1u2GAYHBP3z40CvnXWTLSO8icGv1T0=; b=SraO/lF4EEkFIn5Uqgs4+lo+p2AHx/ybx4cqAa8EPPSwlW6rbPl6vV4C/+MSRPGyZEYqlywDqjQjcagslt7KjWd9tKzq3fS9VCfRVfK7zptqJKDS/2nV7FVq6FNOpZWlA+w4Wu5FVCLGfn+c5mEHv65U/bLv/aL/WOHCCipT83o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669016233811907.7119370115275; Sun, 20 Nov 2022 23:37:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox1M5-0003xb-J0; Mon, 21 Nov 2022 02:36:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox1Lx-0003xP-AN for qemu-devel@nongnu.org; Mon, 21 Nov 2022 02:36:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox1Lv-0002HU-MY for qemu-devel@nongnu.org; Mon, 21 Nov 2022 02:36:28 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-YDemhgd_N4OfEZB6Pjy-Og-1; Mon, 21 Nov 2022 02:36:23 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB84585A59D; Mon, 21 Nov 2022 07:36:22 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 127A2492B06; Mon, 21 Nov 2022 07:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669016187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HWjes4iTCkN/Q1u2GAYHBP3z40CvnXWTLSO8icGv1T0=; b=Oni6btDL1U+qFbSqUQH+3USg71uXKqMy0OY7c7ibIV4l++7hZqYyqLGK/7ulhF/QomKUNl MsWtv3WBdMOXkjo5tdLL1Bg9vmChuEnMur+b4S5YhzasQ0Zl2Lvgp85z/LVVy/sA6AFXzs T4ZEIfiDzsJeH53WYs8bdcS8pY1qJlQ= X-MC-Unique: YDemhgd_N4OfEZB6Pjy-Og-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Bin Meng Subject: [PULL 1/1] chardev/char-win-stdio: Pass Ctrl+C to guest with a multiplexed monitor Date: Mon, 21 Nov 2022 11:36:11 +0400 Message-Id: <20221121073611.1337690-2-marcandre.lureau@redhat.com> In-Reply-To: <20221121073611.1337690-1-marcandre.lureau@redhat.com> References: <20221121073611.1337690-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669016234735100002 From: Bin Meng At present when pressing Ctrl+C from a guest running on QEMU Windows with a multiplexed monitor, e.g.: -serial mon:stdio, QEMU executable just exits. This behavior is inconsistent with the Linux version. Such behavior is caused by unconditionally setting the input mode ENABLE_PROCESSED_INPUT for a console's input buffer. Fix this by testing whether the chardev is allowed to do so. Signed-off-by: Bin Meng Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20221025141015.612291-1-bin.meng@windriver.com> --- chardev/char-win-stdio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c index a4771ab82e..eb830eabd9 100644 --- a/chardev/char-win-stdio.c +++ b/chardev/char-win-stdio.c @@ -146,6 +146,8 @@ static void qemu_chr_open_stdio(Chardev *chr, bool *be_opened, Error **errp) { + ChardevStdio *opts =3D backend->u.stdio.data; + bool stdio_allow_signal =3D !opts->has_signal || opts->signal; WinStdioChardev *stdio =3D WIN_STDIO_CHARDEV(chr); DWORD dwMode; int is_console =3D 0; @@ -193,7 +195,11 @@ static void qemu_chr_open_stdio(Chardev *chr, if (is_console) { /* set the terminal in raw mode */ /* ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS */ - dwMode |=3D ENABLE_PROCESSED_INPUT; + if (stdio_allow_signal) { + dwMode |=3D ENABLE_PROCESSED_INPUT; + } else { + dwMode &=3D ~ENABLE_PROCESSED_INPUT; + } } =20 SetConsoleMode(stdio->hStdIn, dwMode); --=20 2.38.1