[for-next][PATCH 17/25] tools/rv: Stop gracefully also on SIGTERM
From: Steven Rostedt
Date: Fri Jul 25 2025 - 16:37:05 EST
From: Gabriele Monaco <gmonaco@xxxxxxxxxx>
Currently the userspace RV tool starts a monitor and waits for the user
to press Ctrl-C (SIGINT) to terminate and stop the monitor.
This doesn't account for a scenario where a user starts RV in background
and simply kills it (SIGTERM unless the user specifies differently).
E.g.:
# rv mon wip &
# kill %
Would terminate RV without stopping the monitor and next RV executions
won't start correctly.
Register the signal handler used for SIGINT also to SIGTERM.
Cc: Nam Cao <namcao@xxxxxxxxxxxxx>
Cc: Tomas Glozar <tglozar@xxxxxxxxxx>
Cc: Juri Lelli <jlelli@xxxxxxxxxx>
Cc: Clark Williams <williams@xxxxxxxxxx>
Cc: John Kacur <jkacur@xxxxxxxxxx>
Link: https://lore.kernel.org/20250723161240.194860-3-gmonaco@xxxxxxxxxx
Signed-off-by: Gabriele Monaco <gmonaco@xxxxxxxxxx>
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
tools/verification/rv/src/rv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/verification/rv/src/rv.c b/tools/verification/rv/src/rv.c
index 239de054d1e0..b8fe24a87d97 100644
--- a/tools/verification/rv/src/rv.c
+++ b/tools/verification/rv/src/rv.c
@@ -191,6 +191,7 @@ int main(int argc, char **argv)
* and exit.
*/
signal(SIGINT, stop_rv);
+ signal(SIGTERM, stop_rv);
rv_mon(argc - 1, &argv[1]);
}
--
2.47.2