[PATCH v2 02/13] examples: remove printf from signal handler
Stephen Hemminger
stephen at networkplumber.org
Mon Sep 7 19:03:20 CEST 2026
Printf is not a signal safe function, remove useless printf's
that cause warnings in GCC analyzer.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
examples/distributor/main.c | 3 +--
examples/dma/dmafwd.c | 2 --
examples/eventdev_pipeline/main.c | 2 --
examples/flow_filtering/main.c | 5 +----
examples/l2fwd-event/main.c | 5 +----
examples/l2fwd/main.c | 5 +----
examples/l3fwd-graph/main.c | 5 +----
7 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index ea44939fba..0905482cf0 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -529,9 +529,8 @@ lcore_tx(struct rte_ring *in_r)
}
static void
-int_handler(int sig_num)
+int_handler(int sig_num __rte_unused)
{
- printf("Exiting on signal %d\n", sig_num);
/* set quit flag for rx thread to exit */
quit_signal_rx = 1;
}
diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c
index a8ed09e6ae..8d195faddb 100644
--- a/examples/dma/dmafwd.c
+++ b/examples/dma/dmafwd.c
@@ -998,8 +998,6 @@ static void
signal_handler(int signum)
{
if (signum == SIGINT || signum == SIGTERM) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- signum);
force_quit = true;
} else if (signum == SIGUSR1) {
dmadev_dump();
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 0c995d1a70..65e0cd437c 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -319,8 +319,6 @@ signal_handler(int signum)
if (fdata->done)
rte_exit(1, "Exiting on signal %d\n", signum);
if ((signum == SIGINT || signum == SIGTERM) && !once) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- signum);
if (cdata.dump_dev)
rte_event_dev_dump(0, stdout);
once = 1;
diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index f2124881a0..b4ccaacea1 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -266,11 +266,8 @@ init_port(void)
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;
- }
}
/* Parse the argument given in the command line of the application */
diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
index 2d31d4c6ad..c492c6dee0 100644
--- a/examples/l2fwd-event/main.c
+++ b/examples/l2fwd-event/main.c
@@ -582,11 +582,8 @@ static void
signal_handler(int signum)
{
struct l2fwd_resources *rsrc = l2fwd_get_rsrc();
- if (signum == SIGINT || signum == SIGTERM) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- signum);
+ if (signum == SIGINT || signum == SIGTERM)
rsrc->force_quit = true;
- }
}
int
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 1c4a89ae90..851816423f 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -638,11 +638,8 @@ check_all_ports_link_status(uint32_t port_mask)
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;
- }
}
int
diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c
index 5f89286dce..4fa302f5b0 100644
--- a/examples/l3fwd-graph/main.c
+++ b/examples/l3fwd-graph/main.c
@@ -753,11 +753,8 @@ check_all_ports_link_status(uint32_t port_mask)
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
--
2.53.0
More information about the dev
mailing list