On 07-Sep-26 12:24 AM, Stephen Hemminger wrote:
The SIGINT handler calls printf which is not async-signal safe.
Signed-off-by: Stephen Hemminger <[email protected]>
---
examples/ipsec-secgw/ipsec-secgw.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c
b/examples/ipsec-secgw/ipsec-secgw.c
index eba7560c9b..4816bcdd82 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -2448,11 +2448,8 @@ create_default_ipsec_flow(uint16_t port_id, uint64_t
rx_offloads)
static void
signal_handler(int signum)
{
- if (signum == SIGINT || signum == SIGTERM) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- signum);
+ if (signum == SIGINT || signum == SIGTERM)
force_quit = true;
- }
}
static void
I think the same applies to interrupt callbacks (e.g.rte_eth_dev_cb_fn
), many example apps are using printf in those too.
From what I see write() is required to be async signal safe and can be
used instead, in signal handlers and event callbacks, but we will lose
the va args / format specifiers.
https://man7.org/linux/man-pages/man7/signal-safety.7.html