From nobody Fri Nov 29 23:35:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1620401341; cv=none; d=zohomail.com; s=zohoarc; b=QH++Z/KbwQJpvrRHM9bzfIQyai1vWmdx9zdnRq4WG8S5Dv6IFAKieTO4DwPmnDCEVzzzZN8TYqJL3fc/RpNyeLpo66QmUwuv+2ESCm+wmmrVhJ5DVQLloCKq5nGD7sEMdfKPmaXq23rAafjIs6KIAm69J9WYPY/m0R+v01ExOLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620401341; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=S2R/fa2RdHD2/9UG+IkMdvjIN9nmG6evhxBTrhM1Z90=; b=fvcriT1IISEXorzYGRf+2MXSTzb0hu1IywmhiDhTBgpi2DwAlk/RFRs6d8DM6yaKr5ArarrIGhZI1gHpDRZEhBtW8myQpKwJd6Ycq9fd+Zl6/EmYlN77hT8sCsy+MrzJnJInFXXa+dDv6mS+atFWKkp4PeJ7McrRd1QrfvyddEI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1620401341037684.892825431962; Fri, 7 May 2021 08:29:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.124067.234136 (Exim 4.92) (envelope-from ) id 1lf2PC-0001rI-In; Fri, 07 May 2021 15:28:42 +0000 Received: by outflank-mailman (output) from mailman id 124067.234136; Fri, 07 May 2021 15:28:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lf2PC-0001rB-FW; Fri, 07 May 2021 15:28:42 +0000 Received: by outflank-mailman (input) for mailman id 124067; Fri, 07 May 2021 15:28:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lf2PB-0001r5-DE for xen-devel@lists.xenproject.org; Fri, 07 May 2021 15:28:41 +0000 Received: from MTA-09-3.privateemail.com (unknown [68.65.122.19]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d34aa4ec-29a2-408a-aec3-2b265d88776f; Fri, 07 May 2021 15:28:40 +0000 (UTC) Received: from MTA-09.privateemail.com (localhost [127.0.0.1]) by MTA-09.privateemail.com (Postfix) with ESMTP id E137660059; Fri, 7 May 2021 11:28:39 -0400 (EDT) Received: from toma-xps.lan (unknown [10.20.151.239]) by MTA-09.privateemail.com (Postfix) with ESMTPA id 3DC206004F; Fri, 7 May 2021 11:28:39 -0400 (EDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d34aa4ec-29a2-408a-aec3-2b265d88776f From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Cc: Tamas K Lengyel , Ian Jackson , Wei Liu Subject: [PATCH] tools/misc/xen-vmtrace: handle more signals and install by default Date: Fri, 7 May 2021 11:28:36 -0400 Message-Id: <20210507152836.20026-1-tamas@tklengyel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV using ClamSMTP Content-Type: text/plain; charset="utf-8" Signed-off-by: Tamas K Lengyel Acked-by: Andrew Cooper --- tools/misc/Makefile | 2 +- tools/misc/xen-vmtrace.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/misc/Makefile b/tools/misc/Makefile index 2b683819d4..c32c42d546 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -25,6 +25,7 @@ INSTALL_SBIN-$(CONFIG_X86) +=3D xen-lowmemd INSTALL_SBIN-$(CONFIG_X86) +=3D xen-memshare INSTALL_SBIN-$(CONFIG_X86) +=3D xen-mfndump INSTALL_SBIN-$(CONFIG_X86) +=3D xen-ucode +INSTALL_SBIN-$(CONFIG_X86) +=3D xen-vmtrace INSTALL_SBIN +=3D xencov INSTALL_SBIN +=3D xenhypfs INSTALL_SBIN +=3D xenlockprof @@ -51,7 +52,6 @@ TARGETS_COPY +=3D xenpvnetboot TARGETS_BUILD :=3D $(filter-out $(TARGETS_COPY),$(TARGETS_ALL)) =20 # ... including build-only targets -TARGETS_BUILD-$(CONFIG_X86) +=3D xen-vmtrace TARGETS_BUILD +=3D $(TARGETS_BUILD-y) =20 .PHONY: all build diff --git a/tools/misc/xen-vmtrace.c b/tools/misc/xen-vmtrace.c index 35d14c6a9b..5b688a54af 100644 --- a/tools/misc/xen-vmtrace.c +++ b/tools/misc/xen-vmtrace.c @@ -44,7 +44,7 @@ static size_t size; static char *buf; =20 static sig_atomic_t interrupted; -static void int_handler(int signum) +static void close_handler(int signum) { interrupted =3D 1; } @@ -78,8 +78,14 @@ int main(int argc, char **argv) int rc, exit =3D 1; xenforeignmemory_resource_handle *fres =3D NULL; =20 - if ( signal(SIGINT, int_handler) =3D=3D SIG_ERR ) - err(1, "Failed to register signal handler\n"); + struct sigaction act; + act.sa_handler =3D close_handler; + act.sa_flags =3D 0; + sigemptyset(&act.sa_mask); + sigaction(SIGHUP, &act, NULL); + sigaction(SIGTERM, &act, NULL); + sigaction(SIGINT, &act, NULL); + sigaction(SIGALRM, &act, NULL); =20 if ( argc !=3D 3 ) { --=20 2.27.0