From nobody Mon Feb 9 08:58:12 2026 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=1665586746; cv=none; d=zohomail.com; s=zohoarc; b=MNyFnHR9qTQ6mV9c6AS40Ar4pxt2COsERWvvatApFD/FvD24Uk8kuIzFONNTOkzqPIyzGHagZjjrRbWMoyMl3V8g4abO6w/L68bQV5bu429A/82o2AiHwnOCxN9cjJFn5svdEhHNOB5oaHgdmfIobhUV6YMnoO3bMKOwSJu+1nA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665586746; 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=w076SWkJJOkjZFaj0BfZJw5JH0gUIJEhmWVlVD4ADqc=; b=AvMFl38PnU0FihlWntJGPIVn2OUcjeEwRlGqNFQRJKeU0kPiBhxFxwAq/0Sr1Th7CO4gqqfZG96bm1HnlkOcPK96OVCrWKGTOAMAnJf8eI9t5ozYJXHbfWJLID8IYmBNd4W4lwSMUuAiOrN27KCStIyog53R1gS0wQx5u42lkeY= 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 1665586746812138.72080042182324; Wed, 12 Oct 2022 07:59:06 -0700 (PDT) Received: from localhost ([::1]:58754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oidCK-0007qQ-A6 for importer@patchew.org; Wed, 12 Oct 2022 10:59:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oicnk-0005Mf-Ht for qemu-devel@nongnu.org; Wed, 12 Oct 2022 10:33:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43215) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oicni-0006ll-UY for qemu-devel@nongnu.org; Wed, 12 Oct 2022 10:33:40 -0400 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-624-_4b0MgGkOUyUD-06Dxia7w-1; Wed, 12 Oct 2022 10:33:37 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4BC2299E74E; Wed, 12 Oct 2022 14:33:36 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.235]) by smtp.corp.redhat.com (Postfix) with ESMTP id F00212144B20; Wed, 12 Oct 2022 14:33:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665585218; 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=w076SWkJJOkjZFaj0BfZJw5JH0gUIJEhmWVlVD4ADqc=; b=ZU3CMaeDTzmcP27gfuiQeS+iGRRLZNAtxr44A9MaCD3/zIih9wgWSyj/jaJXS/DGaSghTU voIv3tnTZdPVt1bdjUc8ulC1OGuA0RD6Cn53CZqSdP2fBBLAlHvV3GTJsCl7HwOOasy2h3 /guq6w5KmHoR1mCxMAcz1Y5XyS7+qIQ= X-MC-Unique: _4b0MgGkOUyUD-06Dxia7w-1 From: Thomas Huth To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Bin Meng , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 15/16] tests/qtest: libqtest: Install signal handler via signal() Date: Wed, 12 Oct 2022 16:33:15 +0200 Message-Id: <20221012143316.988561-16-thuth@redhat.com> In-Reply-To: <20221012143316.988561-1-thuth@redhat.com> References: <20221012143316.988561-1-thuth@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.6 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=thuth@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, 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" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665586748083100001 From: Bin Meng At present the codes uses sigaction() to install signal handler with a flag SA_RESETHAND. Such usage can be covered by the signal() API that is a simplified interface to the general sigaction() facility. Update to use signal() to install the signal handler, as it is available on Windows which we are going to support. Signed-off-by: Bin Meng Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20221006151927.2079583-11-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth --- tests/qtest/libqtest.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 7b6152807b..b23eb3edc3 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -66,7 +66,7 @@ struct QTestState }; =20 static GHookList abrt_hooks; -static struct sigaction sigact_old; +static void (*sighandler_old)(int); =20 static int qtest_query_target_endianness(QTestState *s); =20 @@ -179,20 +179,12 @@ static void sigabrt_handler(int signo) =20 static void setup_sigabrt_handler(void) { - struct sigaction sigact; - - /* Catch SIGABRT to clean up on g_assert() failure */ - sigact =3D (struct sigaction){ - .sa_handler =3D sigabrt_handler, - .sa_flags =3D SA_RESETHAND, - }; - sigemptyset(&sigact.sa_mask); - sigaction(SIGABRT, &sigact, &sigact_old); + sighandler_old =3D signal(SIGABRT, sigabrt_handler); } =20 static void cleanup_sigabrt_handler(void) { - sigaction(SIGABRT, &sigact_old, NULL); + signal(SIGABRT, sighandler_old); } =20 static bool hook_list_is_empty(GHookList *hook_list) --=20 2.31.1