From: Tamas K Lengyel <tamas@tklengyel.com>
To: xen-devel@lists.xenproject.org
Cc: Tamas K Lengyel <tamas@tklengyel.com>,
Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>
Subject: [PATCH] tools/misc/xen-vmtrace: handle more signals and install by default
Date: Fri, 7 May 2021 11:28:36 -0400 [thread overview]
Message-ID: <20210507152836.20026-1-tamas@tklengyel.com> (raw)
Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
---
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) += xen-lowmemd
INSTALL_SBIN-$(CONFIG_X86) += xen-memshare
INSTALL_SBIN-$(CONFIG_X86) += xen-mfndump
INSTALL_SBIN-$(CONFIG_X86) += xen-ucode
+INSTALL_SBIN-$(CONFIG_X86) += xen-vmtrace
INSTALL_SBIN += xencov
INSTALL_SBIN += xenhypfs
INSTALL_SBIN += xenlockprof
@@ -51,7 +52,6 @@ TARGETS_COPY += xenpvnetboot
TARGETS_BUILD := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL))
# ... including build-only targets
-TARGETS_BUILD-$(CONFIG_X86) += xen-vmtrace
TARGETS_BUILD += $(TARGETS_BUILD-y)
.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;
static sig_atomic_t interrupted;
-static void int_handler(int signum)
+static void close_handler(int signum)
{
interrupted = 1;
}
@@ -78,8 +78,14 @@ int main(int argc, char **argv)
int rc, exit = 1;
xenforeignmemory_resource_handle *fres = NULL;
- if ( signal(SIGINT, int_handler) == SIG_ERR )
- err(1, "Failed to register signal handler\n");
+ struct sigaction act;
+ act.sa_handler = close_handler;
+ act.sa_flags = 0;
+ sigemptyset(&act.sa_mask);
+ sigaction(SIGHUP, &act, NULL);
+ sigaction(SIGTERM, &act, NULL);
+ sigaction(SIGINT, &act, NULL);
+ sigaction(SIGALRM, &act, NULL);
if ( argc != 3 )
{
--
2.27.0
next reply other threads:[~2021-05-07 15:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-07 15:28 Tamas K Lengyel [this message]
2021-06-22 16:13 ` [PATCH] tools/misc/xen-vmtrace: handle more signals and install by default Tamas K Lengyel
2021-07-09 15:37 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210507152836.20026-1-tamas@tklengyel.com \
--to=tamas@tklengyel.com \
--cc=iwj@xenproject.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).