From: jca Date: Thu, 2 Jun 2022 21:38:46 +0000 (+0000) Subject: Let btrace(8) execute the END probe upon receiving a SIGTERM signal X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7ba68130937bae642c32aa655a550ad8543990f1;p=openbsd Let btrace(8) execute the END probe upon receiving a SIGTERM signal While SIGINT (already handled) makes sense for interactive use, handling SIGTERM in the same manner is less surprising for scripting. This lets you do: btrace ... & some workload; kill $! and get the expected output. ok mpi@ --- diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c index 5daaab1f969..1292f71323c 100644 --- a/usr.sbin/btrace/btrace.c +++ b/usr.sbin/btrace/btrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btrace.c,v 1.62 2022/02/22 17:26:04 deraadt Exp $ */ +/* $OpenBSD: btrace.c,v 1.63 2022/06/02 21:38:46 jca Exp $ */ /* * Copyright (c) 2019 - 2021 Martin Pieuchot @@ -385,6 +385,8 @@ rules_do(int fd) sa.sa_handler = signal_handler; if (sigaction(SIGINT, &sa, NULL)) err(1, "sigaction"); + if (sigaction(SIGTERM, &sa, NULL)) + err(1, "sigaction"); rules_setup(fd);