From nobody Sat May 18 04:29:58 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=1675782409; cv=none; d=zohomail.com; s=zohoarc; b=lkU4mTEiSSpoZzRq0i4yGgz2OFijXDQfjFO7FohrzsSN2ytSi0NveSPzu1PX3HoPvW5dndl3fGUSvkl8WYhqBEiDsIN/6MKtNtxuUudoL0/uom0zC2Hsm6VBL0wMqaFNEU6jBH6o8cbcuWtQE0cu5HAioxlBb0oiPxjd9NtiAOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675782409; 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=Zmk18G08raxXr7fJ4g2bzz2Tgoba+zSUGqNVNLtSwDE=; b=Tk84gk0H725HRmj2h7BWK3er70vZVq9PhuCxgyDIwSEzSbOta0FWSvJtjdT4rxTlQIPx0waNEXUbhgfDOfu5Hzye5QS1SNayYiswLub3zNTmm+NeUqXRBZyiexivwQgGkdiGyOYCkY530tQcNI/rfnZg6eql97G82HLDqBWk0Q0= 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 16757824094226.126513895722155; Tue, 7 Feb 2023 07:06:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOux-0007KZ-3n; Tue, 07 Feb 2023 09:25:55 -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 1pPOut-0007JD-EC for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:25:51 -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 1pPOuq-0006DU-P8 for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:25:49 -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-396-urU2PQqPMbqi9OEebeTO9g-1; Tue, 07 Feb 2023 09:25:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 94262100F921; Tue, 7 Feb 2023 14:25:43 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id B09BA404CD80; Tue, 7 Feb 2023 14:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779947; 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=Zmk18G08raxXr7fJ4g2bzz2Tgoba+zSUGqNVNLtSwDE=; b=WWn19MWrq8rSR2ci+2PK5rqE4RrXivKnEItOc4C6EW+mmzWbH2cE+zekKgb/17/ACEyzPQ oXMhoMRPkAIxw5qsBIBok/ZcKEL5PryubpbG0w/lCjkvQdVt6iRWp0DALWYFEeHSo54w6U IwyeT+2RomevjeG9ag+T32vuhB35nhA= X-MC-Unique: urU2PQqPMbqi9OEebeTO9g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 01/10] tests: fix path separator, use g_build_filename() Date: Tue, 7 Feb 2023 18:25:26 +0400 Message-Id: <20230207142535.1153722-2-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.2 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: 1675782410636100003 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- tests/unit/test-io-channel-command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test-io-channel-command.c b/tests/unit/test-io-chan= nel-command.c index 425e2f5594..75d8de43fd 100644 --- a/tests/unit/test-io-channel-command.c +++ b/tests/unit/test-io-channel-command.c @@ -35,7 +35,7 @@ static char *socat =3D NULL; static void test_io_channel_command_fifo(bool async) { g_autofree gchar *tmpdir =3D g_dir_make_tmp("qemu-test-io-channel.XXXX= XX", NULL); - g_autofree gchar *fifo =3D g_strdup_printf("%s/%s", tmpdir, TEST_FIFO); + g_autofree gchar *fifo =3D g_build_filename(tmpdir, TEST_FIFO, NULL); g_autofree gchar *srcargs =3D g_strdup_printf("%s - PIPE:%s,wronly", s= ocat, fifo); g_autofree gchar *dstargs =3D g_strdup_printf("%s PIPE:%s,rdonly -", s= ocat, fifo); g_auto(GStrv) srcargv =3D g_strsplit(srcargs, " ", -1); --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675780577; cv=none; d=zohomail.com; s=zohoarc; b=A2PXoHE8SzrfwikCL1NmiJUHbqsZmvm4bNcibNnSWZ2s8/TtjpoJ0q7NrlHTj3P0txEbhzl6gwbfePtYaWtiCsvB0OERtpxRBTJp/qibcR8xRhh1+0RJ3ZlZFkOHQ54CA6xQal7wavdO29zt5Bms6YLIbZE7rQVa/26oqei7k0s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675780577; 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=KWGZySkEpRmPwEzDmMhdAFN3A39UnpAP1RWhCsgb3vE=; b=P2Ma4vN8Yq4jn6RlgBrWHlD0QhtmpaZ8J3yBlPQcGKJINkW2LhRhHQy5Z533BPKuL0H0PVXywFj9PT75jL5C01EWh9YiP2SeaFDd4hWjKUiTtBVVzslwLnm82cjvwSirmRooI1dHhnomttJ783LLgdkg33BG+xq0xMaLJo+FVAM= 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 1675780577195969.9700532600464; Tue, 7 Feb 2023 06:36:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOv1-0007MM-41; Tue, 07 Feb 2023 09:25:59 -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 1pPOuu-0007KG-Oe for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:25:53 -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 1pPOut-0006Do-6k for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:25:52 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-198-fmvKibgnMm2HGMRzjw2EuQ-1; Tue, 07 Feb 2023 09:25:49 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3CDC2A59563; Tue, 7 Feb 2023 14:25:48 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 845C2404CD80; Tue, 7 Feb 2023 14:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779950; 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=KWGZySkEpRmPwEzDmMhdAFN3A39UnpAP1RWhCsgb3vE=; b=FE5VDfZAluAkTym1GPH9lFgjObG0ItoNagR2TvzBGxrFLoRA/EEfMqo81ku9rAp50TX/vz CHeyVOaEDKtxJEcq3zpNhl+Sjm1/SOfrVjTiumcq5ziVE2c084BXxge7OuIJMqdJeyNRpQ 3mXWM1NaJT7b5tHWkjFg/3pi0JoVpCw= X-MC-Unique: fmvKibgnMm2HGMRzjw2EuQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 02/10] char: do not double-close fd when failing to add client Date: Tue, 7 Feb 2023 18:25:27 +0400 Message-Id: <20230207142535.1153722-3-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.2 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: 1675780578160100003 From: Marc-Andr=C3=A9 Lureau The caller is already closing the fd on failure. Fixes: c3054a6e6a ("char: Factor out qmp_add_client() parts and move to cha= rdev/") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- chardev/char.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 11eab7764c..e69390601f 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -1175,12 +1175,10 @@ bool qmp_add_client_char(int fd, bool has_skipauth,= bool skipauth, =20 if (!s) { error_setg(errp, "protocol '%s' is invalid", protocol); - close(fd); return false; } if (qemu_chr_add_client(s, fd) < 0) { error_setg(errp, "failed to add client"); - close(fd); return false; } return true; --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675781873; cv=none; d=zohomail.com; s=zohoarc; b=T/U4HW45/la1FvOuFql99gX282Sh6f3bNIckowSiUTp6lA8AShocHfJb0GkuZIgcOdfLzzal+flDmokv3bl82oLtbaOw7wv7Uj648R6S4yMJJz2KgifuCHQ1AEmaFU7PGyr5b7nL7tBEIZMWrXpMvXb0HQmA9xX5jT8SMgOHd5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675781873; 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=DXvU789TEkYigJlmTGw/dEZBT6c2vgwmAPq1esT9tVA=; b=jc66Wx+vO8HvLMo+45evYJexfVpzisZ5Q6HJGi4yklzesPK1FlYg31Y6t1t52uAiLGu1XWZI98JjgeRquNR4PEwIfYAReVJCEFBJmsPSRCPkjoV660mv8Tl7sF/A1UM1wyjOfbZqKMT1VjUCiOU9EZ3xo4nrofDcpxN36vuKf44= 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 1675781873912773.4883656251875; Tue, 7 Feb 2023 06:57:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOv3-0007NA-44; Tue, 07 Feb 2023 09:26:01 -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 1pPOv0-0007MO-6C for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:25:58 -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 1pPOuy-0006En-OE for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:25:57 -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-262-u2CE5X9cN7-ib2ENbY0img-1; Tue, 07 Feb 2023 09:25:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 757B518E6C41; Tue, 7 Feb 2023 14:25:52 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B0012026D38; Tue, 7 Feb 2023 14:25:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779956; 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=DXvU789TEkYigJlmTGw/dEZBT6c2vgwmAPq1esT9tVA=; b=Yx/w1V3WQnGihD15faUe8f6znuPiTFgstzrZPlrYfKlPc13y88g7+htTZgqNkkxXJPV9qf v39WBuzK54X3U7pIjMHUPU5QutcbooGec2RJgqYKao1kyNIUxlbD4ku23AW4DHi1D1MbMb Us6XENZpgxBlRCgBCJJWlDr8DLoI7Gw= X-MC-Unique: u2CE5X9cN7-ib2ENbY0img-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 03/10] tests/docker: fix a win32 error due to portability Date: Tue, 7 Feb 2023 18:25:28 +0400 Message-Id: <20230207142535.1153722-4-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.4 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: 1675781874401100003 From: Marc-Andr=C3=A9 Lureau docker.py is run during configure, and produces an error: No module named 'pwd'. Use a more portable and recommended alternative to lookup the user "login name". Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Alex Benn=C3=A9e --- tests/docker/docker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 3a1ed7cb18..688ef62989 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -23,10 +23,10 @@ import tempfile import re import signal +import getpass from tarfile import TarFile, TarInfo from io import StringIO, BytesIO from shutil import copy, rmtree -from pwd import getpwuid from datetime import datetime, timedelta =20 =20 @@ -316,7 +316,7 @@ def build_image(self, tag, docker_dir, dockerfile, =20 if user: uid =3D os.getuid() - uname =3D getpwuid(uid).pw_name + uname =3D getpass.getuser() tmp_df.write("\n") tmp_df.write("RUN id %s 2>/dev/null || useradd -u %d -U %s" % (uname, uid, uname)) @@ -570,7 +570,7 @@ def run(self, args, argv): =20 if args.user: uid =3D os.getuid() - uname =3D getpwuid(uid).pw_name + uname =3D getpass.getuser() df.write("\n") df.write("RUN id %s 2>/dev/null || useradd -u %d -U %s" % (uname, uid, uname)) --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675781940; cv=none; d=zohomail.com; s=zohoarc; b=WYC38eOcIgKGaZbMpPMiiCLtMOLo3kQO4SZ0oPnqtEWZUVj/9Rrcu3Vx3OfD1+sa3f5lplPBBCWzSlKQe5VAEJC9gAgeF8I/B0Dwxl6KUtTqwDOp0tbK/Br+6S6nq+pp1/jp5Piv+Kw281PIOfrMC21jLE+YUI1IB2PBWrqMnIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675781940; 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=qtl4SNIpf1RWo6RcTmh5yr4OwHwqsvHdcf3zej+YUZ0=; b=f69bhChBj+YnEYr7VH5qxpXaOcGFwqRDp+rQ0U62GJkokVZf0A3aN7SBmIw45oHE9mcsA06/dohwprVQxpCqs+JQh7dJF+pEXMipu+4iI2BqgDpKHVUcyu9D/UN/cWTia1+bogjhTORohkppCA6+tChbtg1yqFeHLdaoR1j2BLk= 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 167578194055721.412871440725553; Tue, 7 Feb 2023 06:59:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOv4-0007Nu-L6; Tue, 07 Feb 2023 09:26:02 -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 1pPOv3-0007NO-CS for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:01 -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 1pPOv1-0006FH-OS for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:01 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-658-Ea558N7YNXGJ9x4dr1oAaA-1; Tue, 07 Feb 2023 09:25:57 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 639FB1C07585; Tue, 7 Feb 2023 14:25:57 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D781140EBF4; Tue, 7 Feb 2023 14:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779959; 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=qtl4SNIpf1RWo6RcTmh5yr4OwHwqsvHdcf3zej+YUZ0=; b=BPaWAYMNhznV4n9yTnhR87jt0FbD+emK/zad/nCK9rpqc89zEBAGFAqLeFaRJnpaDqz9/t sJ/PFpxONYnoIIGJMJQGphrDYtMTmWbUH3ZxQ1uqlaTiVKfM4fq8LEQjARPe22OGYa9WFG x0OIq95Mufs8qF8GbMV4VzzLoWu6ID4= X-MC-Unique: Ea558N7YNXGJ9x4dr1oAaA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 04/10] osdep: implement qemu_socketpair() for win32 Date: Tue, 7 Feb 2023 18:25:29 +0400 Message-Id: <20230207142535.1153722-5-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.7 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: 1675781942006100001 From: Marc-Andr=C3=A9 Lureau Manually implement a socketpair() function, using UNIX sockets and simple peer credential checking. QEMU doesn't make much use of socketpair, beside vhost-user which is not available for win32 at this point. However, I intend to use it for writing some new portable tests. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qemu/sockets.h | 2 - util/oslib-win32.c | 110 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 2 deletions(-) diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 2b0698a7c9..d935fd80da 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -15,7 +15,6 @@ int inet_aton(const char *cp, struct in_addr *ia); bool fd_is_socket(int fd); int qemu_socket(int domain, int type, int protocol); =20 -#ifndef WIN32 /** * qemu_socketpair: * @domain: specifies a communication domain, such as PF_UNIX @@ -30,7 +29,6 @@ int qemu_socket(int domain, int type, int protocol); * Return 0 on success. */ int qemu_socketpair(int domain, int type, int protocol, int sv[2]); -#endif =20 int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); /* diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 07ade41800..a7b0d8491e 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -496,6 +496,116 @@ ssize_t qemu_recvfrom_wrap(int sockfd, void *buf, siz= e_t len, int flags, return ret; } =20 +int qemu_socketpair(int domain, int type, int protocol, int sv[2]) +{ + struct sockaddr_un addr =3D { + 0, + }; + socklen_t socklen; + SOCKET listener =3D INVALID_SOCKET; + SOCKET client =3D INVALID_SOCKET; + SOCKET server =3D INVALID_SOCKET; + g_autofree char *path =3D NULL; + int tmpfd; + u_long arg, br; + int ret =3D -1; + + g_return_val_if_fail(sv !=3D NULL, -1); + + addr.sun_family =3D AF_UNIX; + socklen =3D sizeof(addr); + + tmpfd =3D g_file_open_tmp(NULL, &path, NULL); + if (tmpfd =3D=3D -1) { + WSASetLastError(WSAEACCES); + goto out; + } + + close(tmpfd); + + if (strlen(path) >=3D sizeof(addr.sun_path)) { + WSASetLastError(WSAEACCES); + goto out; + } + + strncpy(addr.sun_path, path, sizeof(addr.sun_path) - 1); + + listener =3D socket(domain, type, protocol); + if (listener =3D=3D INVALID_SOCKET) { + goto out; + } + + if (DeleteFile(path) =3D=3D 0 && GetLastError() !=3D ERROR_FILE_NOT_FO= UND) { + WSASetLastError(WSAEACCES); + goto out; + } + g_clear_pointer(&path, g_free); + + if (bind(listener, (struct sockaddr *)&addr, socklen) =3D=3D SOCKET_ER= ROR) { + goto out; + } + + if (listen(listener, 1) =3D=3D SOCKET_ERROR) { + goto out; + } + + client =3D socket(domain, type, protocol); + if (client =3D=3D INVALID_SOCKET) { + goto out; + } + + arg =3D 1; + if (ioctlsocket(client, FIONBIO, &arg) =3D=3D SOCKET_ERROR) { + goto out; + } + + if (connect(client, (struct sockaddr *)&addr, socklen) =3D=3D SOCKET_E= RROR && + WSAGetLastError() !=3D WSAEWOULDBLOCK) { + goto out; + } + + server =3D accept(listener, NULL, NULL); + if (server =3D=3D INVALID_SOCKET) { + goto out; + } + + arg =3D 0; + if (ioctlsocket(client, FIONBIO, &arg) =3D=3D SOCKET_ERROR) { + goto out; + } + + if (WSAIoctl(server, SIO_AF_UNIX_GETPEERPID, NULL, 0U, &arg, sizeof(ar= g), + &br, NULL, NULL) =3D=3D SOCKET_ERROR || + arg !=3D GetCurrentProcessId()) { + WSASetLastError(WSAEACCES); + goto out; + } + + sv[0] =3D server; + server =3D INVALID_SOCKET; + sv[1] =3D client; + client =3D INVALID_SOCKET; + ret =3D 0; + +out: + if (ret =3D=3D -1) { + errno =3D socket_error(); + } + if (listener !=3D INVALID_SOCKET) { + closesocket(listener); + } + if (client !=3D INVALID_SOCKET) { + closesocket(client); + } + if (server !=3D INVALID_SOCKET) { + closesocket(server); + } + if (path) { + DeleteFile(path); + } + return ret; +} + bool qemu_write_pidfile(const char *filename, Error **errp) { char buffer[128]; --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675781610; cv=none; d=zohomail.com; s=zohoarc; b=lHrX8/iZTdyY9JNGtef2/SEZvMrWq4YTZ/1XwveJBtQ73/pDeK1cqz164IK6VjHhhPy/R8YiF7i8CqgfSpcbypBLW48nqNU0kYpJVoSvbO0WBRPp+TxjM3H+Yao+KItwAszJPwI1yRxPljFpb/qVc62OB641HPrwoyqW61WHfgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675781610; 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=jfZzp9eQLx9MzCy7m7jEMvZMxYSSx6xPAtQ18jaeEig=; b=M+c0GGhCCKB/7HoXkr+NuBkX9x1Gj2S9d/xbKsC2fr9zAXvS1cqMtvFaA/273ylBNahTI5isGg+JFI1mmniiFMKfjGMjPAB9g1GafIZbkfZ7TyelKA+fwbiiP5KUXQnHTS2VOv/h7xJFYsuGQriK9MzkaCUPeaq29BPK5S28o8o= 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 167578161063549.97307427492615; Tue, 7 Feb 2023 06:53:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOvC-0007Tg-JZ; Tue, 07 Feb 2023 09:26:10 -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 1pPOv9-0007Rd-Co for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPOv7-0006GZ-RN for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:07 -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-41-80_2HFKINESTIMmTKiZqQA-1; Tue, 07 Feb 2023 09:26:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F783857AA4; Tue, 7 Feb 2023 14:26:01 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A67D401014C; Tue, 7 Feb 2023 14:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779965; 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=jfZzp9eQLx9MzCy7m7jEMvZMxYSSx6xPAtQ18jaeEig=; b=L4v+ID4hYjFvNrnpgyMzxQ9WGqoLC2Lxnwuu/e4ztDQ/JlFE1vjo7Sko4f5fQo8mVlly0U 6YXlXEm3sGkaIcmsqHETnOBV5sb/kvA2/et4GBN+FtNpsYr39m76H1qOE+50nfYi9aRypI q2Ki0XPMetnj4bGNvpbRT1RoRZA/nrM= X-MC-Unique: 80_2HFKINESTIMmTKiZqQA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 05/10] qmp: 'add_client' actually expects sockets Date: Tue, 7 Feb 2023 18:25:30 +0400 Message-Id: <20230207142535.1153722-6-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.1 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.129.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: 1675781611008100001 From: Marc-Andr=C3=A9 Lureau Whether it is SPICE, VNC, D-Bus, or the socket chardev, they all actually expect a socket kind or will fail in different ways at runtime. Throw an error early if the given 'add_client' fd is not a socket, and close it to avoid leaks. This allows to replace the close() call with a more correct & portable closesocket() version. (this will allow importing sockets on Windows with a specialized command in the following patch, while keeping the remaining monitor associated sockets/add_client code & usage untouched) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- monitor/qmp-cmds.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 859012aef4..2dae6bb10f 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -14,6 +14,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/sockets.h" #include "monitor-internal.h" #include "monitor/qdev.h" #include "monitor/qmp-helpers.h" @@ -139,11 +140,17 @@ void qmp_add_client(const char *protocol, const char = *fdname, return; } =20 + if (!fd_is_socket(fd)) { + error_setg(errp, "add_client expects a socket"); + close(fd); + return; + } + for (i =3D 0; i < ARRAY_SIZE(protocol_table); i++) { if (!strcmp(protocol, protocol_table[i].name)) { if (!protocol_table[i].add_client(fd, has_skipauth, skipauth, has_tls, tls, errp)) { - close(fd); + closesocket(fd); } return; } @@ -151,7 +158,7 @@ void qmp_add_client(const char *protocol, const char *f= dname, =20 if (!qmp_add_client_char(fd, has_skipauth, skipauth, has_tls, tls, protocol, errp)) { - close(fd); + closesocket(fd); } } =20 --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675780827; cv=none; d=zohomail.com; s=zohoarc; b=mt7ZfAOp+zaxSkhnxKLtZzFr6zkvD9zVQnJiHwqY5wk1mbtnXLa//DEOId5NYoRVwSWKZ0FfH/Mcr3NY9lUVOR7HDiQsyE1kpCfXqNKlQ9VxahORmt30LGFs9oiymvrhbWy7icNZoPAx/VvuY+0xD98GRS7PvR4bbpopOSXvDdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675780827; 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=odFOL3cg61TDWscFaLr3f9+xIKavyEThhYBqETsyNZI=; b=Dl92F1heMEbkBKfcDoqsn3j1lh5ElHw8SsvtjDFz4KLRapcHx/iI+NQply7qromtGVIVZniWFY5L3/4gM8PMdfpOBwOl/neodHhglJo3xjWXCoM8iamW4G1kQJF3kq1r4J8Cu8An6aUwWFyEF5ip3ybHbxv0gujLIj6adKtMtGw= 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 1675780827563445.6334422940897; Tue, 7 Feb 2023 06:40:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOvG-0007VC-9U; Tue, 07 Feb 2023 09:26:14 -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 1pPOvF-0007Us-1q for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:13 -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 1pPOvD-0006IZ-DI for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:12 -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-82-MNcM4QNeN1iXf5AelRjVAQ-1; Tue, 07 Feb 2023 09:26:06 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C1BCD100F91B; Tue, 7 Feb 2023 14:26:05 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id A97D21410F36; Tue, 7 Feb 2023 14:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779969; 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=odFOL3cg61TDWscFaLr3f9+xIKavyEThhYBqETsyNZI=; b=X2i+yulHDr8TAq9fMCP1tqCBYfcxBkyUk/2CGOt/xqGkFN61gTwac/9FIzJYYzFslDV+Jq 65n+zh6WvA3qTihJqrWkqXcsBqvaKzrny7obSW6R0wokG/ZrMHaYuMKQ/VhmNjAiSK4g5t kAJPdx1ahXAlAsYAEpS5YW1VcO8FGfg= X-MC-Unique: MNcM4QNeN1iXf5AelRjVAQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 06/10] monitor: release the lock before calling close() Date: Tue, 7 Feb 2023 18:25:31 +0400 Message-Id: <20230207142535.1153722-7-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.7 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: 1675780828014100001 From: Marc-Andr=C3=A9 Lureau As per comment, presumably to avoid syscall in critical section. Fixes: 0210c3b39bef08 ("monitor: Use LOCK_GUARD macros") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- monitor/fds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitor/fds.c b/monitor/fds.c index 26b39a0ce6..03c5e97c35 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -80,7 +80,7 @@ void qmp_getfd(const char *fdname, Error **errp) return; } =20 - QEMU_LOCK_GUARD(&cur_mon->mon_lock); + qemu_mutex_lock(&cur_mon->mon_lock); QLIST_FOREACH(monfd, &cur_mon->fds, next) { if (strcmp(monfd->name, fdname) !=3D 0) { continue; @@ -88,6 +88,7 @@ void qmp_getfd(const char *fdname, Error **errp) =20 tmp_fd =3D monfd->fd; monfd->fd =3D fd; + qemu_mutex_unlock(&cur_mon->mon_lock); /* Make sure close() is outside critical section */ close(tmp_fd); return; @@ -98,6 +99,7 @@ void qmp_getfd(const char *fdname, Error **errp) monfd->fd =3D fd; =20 QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next); + qemu_mutex_unlock(&cur_mon->mon_lock); } =20 void qmp_closefd(const char *fdname, Error **errp) --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675782203; cv=none; d=zohomail.com; s=zohoarc; b=XvhnlFJjg/qZ67dZlUnEggANoIMcW6w7yVg2aMpivTv2tyKrEcZiOXiZTGptZ1ANFn2AcME8ju9nZHX7lLYePt/hG2p3yq7ORz7Ahe/b+EAap1MtQUTbphqT5EAqLFVHefKyUSLqhb/vTRw16/dDBO5tW9SwKo7D1p9ydHGr4Ko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675782203; 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=NhHXydFI0TtNZY/17kwXRMemx9Mdt7dhyIDBKvB2xRg=; b=UhWdRIb1XSuvCQCN9LpWQqgdW3vWBOOCWkvx1KfKQ1iSFiZQjC0YnDSdKiNMIELvAT1sslfuAbP2/kLe1pcIFMhhmQ+c2XoX0+HOnup9IcMw1zg1OFd8+XdFR5kB7+P3hPfoKfitbLUIJgtwMedJv5bMkwIV2c52uu6nII3pwEM= 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 1675782203007510.95019527053284; Tue, 7 Feb 2023 07:03:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOvH-0007Vl-TR; Tue, 07 Feb 2023 09:26:15 -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 1pPOvG-0007VB-6X for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPOvE-0006Km-Bc for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:13 -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-351-V2h-jVGlPRCSIIAFxIUrtg-1; Tue, 07 Feb 2023 09:26:10 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D2EDD823D5F; Tue, 7 Feb 2023 14:26:09 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B811140EBF4; Tue, 7 Feb 2023 14:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779971; 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=NhHXydFI0TtNZY/17kwXRMemx9Mdt7dhyIDBKvB2xRg=; b=aFg+THNTqlnNtLjZ7FE565iT84BbaWwq6F2+S4vUyx3HKO4Lq8o8W1fRF7ybeqH8sePklw 1d5r4wdj+m2kLOjhrZR+uutCLB0aB9SYwCb+g1BAqW+VZqHcWCNabtJbmBIEEBbUv3YdqH NIWhLzNitmAlYQHCaTDfGfUsTyCs01U= X-MC-Unique: V2h-jVGlPRCSIIAFxIUrtg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 07/10] qapi: implement conditional command arguments Date: Tue, 7 Feb 2023 18:25:32 +0400 Message-Id: <20230207142535.1153722-8-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.7 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.129.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: 1675782204349100001 From: Marc-Andr=C3=A9 Lureau The generated code doesn't quite handle the conditional arguments. For example, 'bar' in 'test-if-cmd' is not correctly surrounded by #if conditions. See generated code in qmp_marshal_test_if_cmd(). Note that if there are multiple optional arguments at the last position, there might be compilation issues due to extra comas. I left an assert and FIXME for later. Signed-off-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/commands.py | 4 ++++ scripts/qapi/gen.py | 19 ++++++++++++++----- scripts/qapi/visit.py | 2 ++ tests/qapi-schema/qapi-schema-test.json | 3 ++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/scripts/qapi/commands.py b/scripts/qapi/commands.py index 79c5e5c3a9..07997d1586 100644 --- a/scripts/qapi/commands.py +++ b/scripts/qapi/commands.py @@ -64,9 +64,13 @@ def gen_call(name: str, elif arg_type: assert not arg_type.variants for memb in arg_type.members: + if memb.ifcond.is_present(): + argstr +=3D '\n' + memb.ifcond.gen_if() if memb.need_has(): argstr +=3D 'arg.has_%s, ' % c_name(memb.name) argstr +=3D 'arg.%s, ' % c_name(memb.name) + if memb.ifcond.is_present(): + argstr +=3D '\n' + memb.ifcond.gen_endif() =20 lhs =3D '' if ret_type: diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index b5a8d03e8e..ba57e72c9b 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -111,22 +111,31 @@ def build_params(arg_type: Optional[QAPISchemaObjectT= ype], boxed: bool, extra: Optional[str] =3D None) -> str: ret =3D '' - sep =3D '' if boxed: assert arg_type ret +=3D '%s arg' % arg_type.c_param_type() - sep =3D ', ' + if extra: + ret +=3D ', ' elif arg_type: assert not arg_type.variants + n =3D 0 for memb in arg_type.members: - ret +=3D sep - sep =3D ', ' + n +=3D 1 + if memb.ifcond.is_present(): + ret +=3D '\n' + memb.ifcond.gen_if() if memb.need_has(): ret +=3D 'bool has_%s, ' % c_name(memb.name) ret +=3D '%s %s' % (memb.type.c_param_type(), c_name(memb.name)) + if extra or n !=3D len(arg_type.members): + ret +=3D ', ' + else: + # FIXME: optional last argument may break compilation + assert not memb.ifcond.is_present() + if memb.ifcond.is_present(): + ret +=3D '\n' + memb.ifcond.gen_endif() if extra: - ret +=3D sep + extra + ret +=3D extra return ret if ret else 'void' =20 =20 diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 26a584ee4c..c56ea4d724 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -74,11 +74,13 @@ def gen_visit_object_members(name: str, sep =3D '' for memb in members: if memb.optional and not memb.need_has(): + ret +=3D memb.ifcond.gen_if() ret +=3D mcgen(''' bool has_%(c_name)s =3D !!obj->%(c_name)s; ''', c_name=3Dc_name(memb.name)) sep =3D '\n' + ret +=3D memb.ifcond.gen_endif() ret +=3D sep =20 if base: diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index ba7302f42b..baa4e69f63 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -258,7 +258,8 @@ =20 { 'event': 'TEST_IF_EVENT', 'data': { 'foo': 'TestIfStruct', - 'bar': { 'type': ['TestIfEnum'], 'if': 'TEST_IF_EVT_BAR' } }, + 'bar': { 'type': ['TestIfEnum'], 'if': 'TEST_IF_EVT_BAR' }, + 'baz': 'int' }, 'if': { 'all': ['TEST_IF_EVT', 'TEST_IF_STRUCT'] } } =20 { 'event': 'TEST_IF_EVENT2', 'data': {}, --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675783703; cv=none; d=zohomail.com; s=zohoarc; b=BWOM7USN9NqR8MBgoQPkrKblTJzbeUbFTrWTw0Pb+LRTIB8IM9Iflr5Smasm7G/UKUvYf2bocuTtopRrK1V48vFz9KA2cK9ekKVTZGamu7ijeFOVEUDGuoI2IX/BloyQjEhgwPoh/HO/UyxhgfY9u+tqKbBdhvSbfli4LPwViKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675783703; 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=LfCMYotDh8f6Nxvoi3dPXXnqkaGiK9S2VLG0NcyGXN0=; b=YRXO+Qjiv2gq4LIRqj4d4JQVaDZn2CczlZLnFLxUxl5XJHq8D1dAw7cJ5+BjIWyacnuQg2Hhb39+DQsEo+56INIqmPWys7u2nOJmNG3byO4pKXqCYLDDp+q6SDZG2thR2u/IAm3sWfobOpjbx5dkAHXBnDnsSz1jjDLt8x3dY6s= 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 1675783703945248.720637045349; Tue, 7 Feb 2023 07:28:23 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOvN-0007kV-EZ; Tue, 07 Feb 2023 09:26:21 -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 1pPOvM-0007Xm-2S for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPOvK-0006N3-Cg for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:19 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-tX7l_2tiO0-UwLMgDkAVmA-1; Tue, 07 Feb 2023 09:26:14 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 447253C0D85E; Tue, 7 Feb 2023 14:26:14 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE221492C3C; Tue, 7 Feb 2023 14:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779977; 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=LfCMYotDh8f6Nxvoi3dPXXnqkaGiK9S2VLG0NcyGXN0=; b=hVDDKl1kYXCAerEct0gyK3VuPEyL/k+C8wk2BGMuON0DVO5vhgkfVq53GgAvqUQ8LYbH8b mRLkubB6J2jHNZZWKoq88Bx/+aqp1AcNjd3nAS8anTCyzWLSRtU9uQRYOwm2UTmenbAyvK SG4aiEC2tHHZbYEiNxG4o6eR1a4o9Og= X-MC-Unique: tX7l_2tiO0-UwLMgDkAVmA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 08/10] qmp: teach 'getfd' to import sockets on win32 Date: Tue, 7 Feb 2023 18:25:33 +0400 Message-Id: <20230207142535.1153722-9-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.9 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.129.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: 1675783704421100001 From: Marc-Andr=C3=A9 Lureau A process with enough capabilities can duplicate a socket to QEMU. Modify 'getfd' to import it and add it to the monitor fd list, so it can be later used by other commands. Note that we actually store the SOCKET in the FD list, appropriate care must now be taken to use the correct socket functions (similar approach is taken by our io/ code and in glib, this is internal and shouldn't affect the QEMU/QMP users) Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/misc.json | 16 ++++++++-- monitor/fds.c | 79 ++++++++++++++++++++++++++++++++++++---------- monitor/hmp-cmds.c | 6 +++- 3 files changed, 81 insertions(+), 20 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index 27ef5a2b20..cd36d8befb 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -249,10 +249,18 @@ ## # @getfd: # -# Receive a file descriptor via SCM rights and assign it a name +# On UNIX, receive a file descriptor via SCM rights and assign it a name. +# +# On Windows, (where ancillary socket fd-passing isn't an option yet), add= a +# socket that was duplicated to QEMU process with WSADuplicateSocketW() via +# WSASocket() & WSAPROTOCOL_INFOW structure and assign it a name. A SOCKET= is +# considered as a kind of "file descriptor" in QMP context, for historical +# reasons and simplicity. QEMU takes care to use socket functions appropri= ately. # # @fdname: file descriptor name # +# @wsa-info: a WSAPROTOCOL_INFOW structure (encoded in base64). Since 8.0. +# # Returns: Nothing on success # # Since: 0.14 @@ -270,7 +278,11 @@ # <- { "return": {} } # ## -{ 'command': 'getfd', 'data': {'fdname': 'str'} } +{ 'command': 'getfd', 'data': { + 'fdname': 'str', + '*wsa-info': {'type': 'str', 'if': 'CONFIG_WIN32'} + } +} =20 ## # @closefd: diff --git a/monitor/fds.c b/monitor/fds.c index 03c5e97c35..a876e1128e 100644 --- a/monitor/fds.c +++ b/monitor/fds.c @@ -29,6 +29,7 @@ #include "qapi/qmp/qerror.h" #include "qemu/ctype.h" #include "qemu/cutils.h" +#include "qemu/sockets.h" #include "sysemu/runstate.h" =20 /* file descriptors passed via SCM_RIGHTS */ @@ -61,36 +62,38 @@ struct MonFdset { static QemuMutex mon_fdsets_lock; static QLIST_HEAD(, MonFdset) mon_fdsets; =20 -void qmp_getfd(const char *fdname, Error **errp) +static void close_fd(int fd) { - Monitor *cur_mon =3D monitor_cur(); - mon_fd_t *monfd; - int fd, tmp_fd; - - fd =3D qemu_chr_fe_get_msgfd(&cur_mon->chr); - if (fd =3D=3D -1) { - error_setg(errp, "No file descriptor supplied via SCM_RIGHTS"); - return; + if (fd_is_socket(fd)) { + closesocket(fd); + } else { + close(fd); } +} + +static void monitor_add_fd(Monitor *mon, int fd, const char *fdname, Error= **errp) +{ + mon_fd_t *monfd; + int tmp_fd; =20 if (qemu_isdigit(fdname[0])) { - close(fd); + close_fd(fd); error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "fdname", "a name not starting with a digit"); return; } =20 - qemu_mutex_lock(&cur_mon->mon_lock); - QLIST_FOREACH(monfd, &cur_mon->fds, next) { + qemu_mutex_lock(&mon->mon_lock); + QLIST_FOREACH(monfd, &mon->fds, next) { if (strcmp(monfd->name, fdname) !=3D 0) { continue; } =20 tmp_fd =3D monfd->fd; monfd->fd =3D fd; - qemu_mutex_unlock(&cur_mon->mon_lock); + qemu_mutex_unlock(&mon->mon_lock); /* Make sure close() is outside critical section */ - close(tmp_fd); + close_fd(tmp_fd); return; } =20 @@ -98,8 +101,50 @@ void qmp_getfd(const char *fdname, Error **errp) monfd->name =3D g_strdup(fdname); monfd->fd =3D fd; =20 - QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next); - qemu_mutex_unlock(&cur_mon->mon_lock); + QLIST_INSERT_HEAD(&mon->fds, monfd, next); + qemu_mutex_unlock(&mon->mon_lock); +} + +void qmp_getfd(const char *fdname, +#ifdef WIN32 + const char *wsa_info, +#endif + Error **errp) +{ + Monitor *cur_mon =3D monitor_cur(); + int fd; + +#ifdef WIN32 + if (wsa_info) { + g_autofree WSAPROTOCOL_INFOW *info =3D NULL; + gsize len; + SOCKET sk; + + info =3D (void *)g_base64_decode(wsa_info, &len); + if (len !=3D sizeof(*info)) { + error_setg(errp, "Invalid WSAPROTOCOL_INFOW value"); + return; + } + + sk =3D WSASocketW(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, info, 0, 0); + if (sk =3D=3D INVALID_SOCKET) { + g_autofree gchar *emsg =3D g_win32_error_message(WSAGetLastErr= or()); + error_setg(errp, "Couldn't create socket: %s", emsg); + return; + } + + return monitor_add_fd(cur_mon, sk, fdname, errp); + } +#endif + + fd =3D qemu_chr_fe_get_msgfd(&cur_mon->chr); + if (fd =3D=3D -1) { + error_setg(errp, "No file descriptor supplied via SCM_RIGHTS"); + return; + } + + return monitor_add_fd(cur_mon, fd, fdname, errp); } =20 void qmp_closefd(const char *fdname, Error **errp) @@ -120,7 +165,7 @@ void qmp_closefd(const char *fdname, Error **errp) g_free(monfd); qemu_mutex_unlock(&cur_mon->mon_lock); /* Make sure close() is outside critical section */ - close(tmp_fd); + close_fd(tmp_fd); return; } =20 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 34bd8c67d7..46930bc1a9 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -197,7 +197,11 @@ void hmp_getfd(Monitor *mon, const QDict *qdict) const char *fdname =3D qdict_get_str(qdict, "fdname"); Error *err =3D NULL; =20 - qmp_getfd(fdname, &err); + qmp_getfd(fdname, +#ifdef WIN32 + NULL, +#endif + &err); hmp_handle_error(mon, err); } =20 --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675781010; cv=none; d=zohomail.com; s=zohoarc; b=PfOpMNhcJvG5rnnThvWuKn+tVRiOkjuF7SeRnZ0ZbCVGhyGJ+ijqqcxrG+0uaRHNDpwALlX4e+Bo9RmMdZg0RsL4QOS/mHSWqt89CUq/3r2mp16VIgtBjr9wYFQd3pAJE7x1kJW83YTio6qQzQXlBawGMCp46AjXXMQs6x788y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675781010; 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=3pgbEJTPKy3Fpqp8myon8XxEY5PTK0MIMiBNlQG9UVQ=; b=LNWCZzuEqJBHTTIKSaAo+ms8L6arEwZhm+mQdf5lQV+1WeOQ5nLjvBQWtV1pTmFAvSRqj5crYjKPxD9xIhdnLK8sjjJqosXUkp45FRhjw7tEWh+Ybk55KsZBRukIK82FoUvnqEaIKqN1bCNw7S2X/5dx+x5kuO1nzo6FARTbA6A= 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 1675781010507140.9760459153283; Tue, 7 Feb 2023 06:43:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOvY-00005C-1L; Tue, 07 Feb 2023 09:26:32 -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 1pPOvW-0008W1-FY for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPOvU-0006OJ-R4 for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:30 -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-489-OuJKBgX5MCKKGrhJZvQTqQ-1; Tue, 07 Feb 2023 09:26:25 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 599E188B7AA; Tue, 7 Feb 2023 14:26:18 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FDC11121315; Tue, 7 Feb 2023 14:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779988; 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=3pgbEJTPKy3Fpqp8myon8XxEY5PTK0MIMiBNlQG9UVQ=; b=aCE1l5urbnyj6GU4jojrmhBjQp4JBfshNCD+jKr4Ks6ORQwTGNeF9s9MUkTVQc5sJD9dE7 Ld2dw5H+6NgZj/eps/ywSGVcLxHlWGzJ3MP9gKfn8+r0l/YwieZHCT5O5gOo21mqggQ3vN rPQddxBAuqP0gh1IXYf3zKoev/0sySo= X-MC-Unique: OuJKBgX5MCKKGrhJZvQTqQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 09/10] libqtest: make qtest_qmp_add_client work on win32 Date: Tue, 7 Feb 2023 18:25:34 +0400 Message-Id: <20230207142535.1153722-10-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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.3 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.129.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: 1675781012453100003 From: Marc-Andr=C3=A9 Lureau Duplicate a socket to QEMU, and add it via 'getfd' on win32. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/libqtest.h | 2 -- tests/qtest/libqtest.c | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index fcf1c3c3b3..36186cd946 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -758,7 +758,6 @@ void qtest_qmp_device_add_qdict(QTestState *qts, const = char *drv, void qtest_qmp_device_add(QTestState *qts, const char *driver, const char = *id, const char *fmt, ...) G_GNUC_PRINTF(4, 5); =20 -#ifndef _WIN32 /** * qtest_qmp_add_client: * @qts: QTestState instance to operate on @@ -768,7 +767,6 @@ void qtest_qmp_device_add(QTestState *qts, const char *= driver, const char *id, * Call QMP ``getfd`` followed by ``add_client`` with the given @fd. */ void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd); -#endif /* _WIN32 */ =20 /** * qtest_qmp_device_del_send: diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index d658222a19..30177ea784 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1460,13 +1460,26 @@ void qtest_qmp_device_add(QTestState *qts, const ch= ar *driver, const char *id, qobject_unref(args); } =20 -#ifndef _WIN32 void qtest_qmp_add_client(QTestState *qts, const char *protocol, int fd) { QDict *resp; =20 +#ifdef WIN32 + WSAPROTOCOL_INFOW info; + g_autofree char *info64 =3D NULL; + + assert(fd_is_socket(fd)); + if (WSADuplicateSocketW(fd, GetProcessId((HANDLE)qts->qemu_pid), &info= ) =3D=3D SOCKET_ERROR) { + g_autofree char *emsg =3D g_win32_error_message(WSAGetLastError()); + g_error("WSADuplicateSocketW failed: %s", emsg); + } + info64 =3D g_base64_encode((guchar *)&info, sizeof(info)); + resp =3D qtest_qmp(qts, "{'execute': 'getfd'," + "'arguments': {'fdname': 'fdname', 'wsa-info': %s}}",= info64); +#else resp =3D qtest_qmp_fds(qts, &fd, 1, "{'execute': 'getfd'," "'arguments': {'fdname': 'fdname'}}"); +#endif g_assert(resp); g_assert(!qdict_haskey(resp, "event")); /* We don't expect any events = */ g_assert(!qdict_haskey(resp, "error")); @@ -1480,7 +1493,6 @@ void qtest_qmp_add_client(QTestState *qts, const char= *protocol, int fd) g_assert(!qdict_haskey(resp, "error")); qobject_unref(resp); } -#endif =20 /* * Generic hot-unplugging test via the device_del QMP command. --=20 2.39.1 From nobody Sat May 18 04:29:58 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=1675783741; cv=none; d=zohomail.com; s=zohoarc; b=UK8PMw2aJl5OPAlF4BNvaNWbS4b1kFpkd32V5244wB00FmH0ULLiVG73SsqVg7dLQGkXkuGc/2swqaJ+ZjccdN1IGlZLu5iPyq/y73sGRUme4XIaQn4lHulBcvVRK9HW49lykDMaWP+XwV3cytOu1ZuNlbJQOSzAX6bsFykUITw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675783741; 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=XcG5Ofpku2P6U6QsS5vFI6NQFICT1WobQ6Kdk3RgC7Y=; b=ZZQ1NBMoLIvVDAaCmEZWLVdyATmZxV6Ca4tCClRkbOMDJaprvef7b08aL7weZUUFQKzBTzGWdmfruQdHBb0cddLZCHK7enXkajIkDS+yB4cKHALrZEYmbilV49Ne2yTbXlnrdnNVo9fiEHhQzXz74w6k5lEnIVwcVb0k/hn96vM= 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 1675783741985575.3704642549968; Tue, 7 Feb 2023 07:29:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPOvW-0008W2-I1; Tue, 07 Feb 2023 09:26:30 -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 1pPOvU-0008TV-Nr for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26:28 -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 1pPOvT-0006O3-9G for qemu-devel@nongnu.org; Tue, 07 Feb 2023 09:26: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-96-rLX1fFbPOueZli2gJOFWSg-1; Tue, 07 Feb 2023 09:26:24 -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 8CF72104F0A8; Tue, 7 Feb 2023 14:26:22 +0000 (UTC) Received: from localhost (unknown [10.39.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81698492B21; Tue, 7 Feb 2023 14:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675779986; 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=XcG5Ofpku2P6U6QsS5vFI6NQFICT1WobQ6Kdk3RgC7Y=; b=fTDaiJ3EGjONkqlL4M5SfChpDvHJAcmPjJehg8287rlXkqY23x6nDOw3rLUe67H4oFPEav XhLnwcn7iJr9d3N8fmOj7+8IRaPdjZL14coSgpI7jGzs8MJ7tpe92QvFc5i0Ibp1fjbaLw qCKjDdIO8O1Q7Zjp0SfZ2kUqP0jZu2s= X-MC-Unique: rLX1fFbPOueZli2gJOFWSg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Beraldo Leal , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Eric Blake , Stefan Weil , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Laurent Vivier , "Dr. David Alan Gilbert" , Gerd Hoffmann , Michael Roth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta Subject: [PATCH v3 10/10] qtest: enable vnc-display test on win32 Date: Tue, 7 Feb 2023 18:25:35 +0400 Message-Id: <20230207142535.1153722-11-marcandre.lureau@redhat.com> In-Reply-To: <20230207142535.1153722-1-marcandre.lureau@redhat.com> References: <20230207142535.1153722-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: 1675783742335100001 From: Marc-Andr=C3=A9 Lureau Now that qtest_qmp_add_client() works on win32, we can enable the VNC test. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/vnc-display-test.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/qtest/vnc-display-test.c b/tests/qtest/vnc-display-test.c index e52a4326ec..2c47db8d4c 100644 --- a/tests/qtest/vnc-display-test.c +++ b/tests/qtest/vnc-display-test.c @@ -19,7 +19,7 @@ typedef struct Test { GMainLoop *loop; } Test; =20 -#if !defined(WIN32) && !defined(CONFIG_DARWIN) +#if !defined(CONFIG_DARWIN) =20 static void on_vnc_error(VncConnection* self, const char* msg) @@ -38,10 +38,7 @@ static void on_vnc_auth_failure(VncConnection *self, static bool test_setup(Test *test) { -#ifdef WIN32 - g_test_skip("Not supported on Windows yet"); - return false; -#elif defined(CONFIG_DARWIN) +#if defined(CONFIG_DARWIN) g_test_skip("Broken on Darwin"); return false; #else --=20 2.39.1