From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Bruce Richardson <bruce.richardson@intel.com>,
Chengwen Feng <fengchengwen@huawei.com>,
Kevin Laatz <kevin.laatz@intel.com>, Ori Kam <orika@nvidia.com>,
Sunil Kumar Kori <skori@marvell.com>,
Pavan Nikhilesh <pbhagavatula@marvell.com>,
Jerin Jacob <jerinj@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Zhirun Yan <yanzhirun_163@163.com>
Subject: [PATCH v2 02/13] examples: remove printf from signal handler
Date: Mon, 7 Sep 2026 10:03:20 -0700 [thread overview]
Message-ID: <20260907170454.351647-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20260907170454.351647-1-stephen@networkplumber.org>
Printf is not a signal safe function, remove useless printf's
that cause warnings in GCC analyzer.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@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
next prev parent reply other threads:[~2026-09-07 17:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 23:24 [PATCH 00/13] make signal handlers async-signal-safe Stephen Hemminger
2026-09-06 23:24 ` [PATCH 01/13] graph: do not call printf in signal Stephen Hemminger
2026-09-06 23:24 ` [PATCH 02/13] examples: remove printf from signal handler Stephen Hemminger
2026-09-06 23:24 ` [PATCH 03/13] examples/vmdq: do not print " Stephen Hemminger
2026-09-06 23:24 ` [PATCH 04/13] examples/symmetric_mp: do not print or exit in handler Stephen Hemminger
2026-09-06 23:24 ` [PATCH 05/13] examples/vdpa: make signal handler safe Stephen Hemminger
2026-09-06 23:24 ` [PATCH 06/13] examples/vhost: " Stephen Hemminger
2026-09-06 23:24 ` [PATCH 07/13] examples/vhost_blk: do not tear down from signal handler Stephen Hemminger
2026-09-06 23:24 ` [PATCH 08/13] examples/ntb: do not print and re-raise " Stephen Hemminger
2026-09-06 23:24 ` [PATCH 09/13] examples/ipsecgw: do not print " Stephen Hemminger
2026-09-08 11:19 ` Radu Nicolau
2026-09-06 23:24 ` [PATCH 10/13] examples/l2fwd-macsec: remove print in " Stephen Hemminger
2026-09-06 23:24 ` [PATCH 11/13] examples/ethtool: fix exit flag and unchecked cmdline Stephen Hemminger
2026-09-06 23:24 ` [PATCH 12/13] examples/vmdq_dcb: allow exit on signal Stephen Hemminger
2026-09-06 23:24 ` [PATCH 13/13] examples/eventdev_pipeline: make signal handler safe Stephen Hemminger
2026-09-07 9:06 ` [PATCH 00/13] make signal handlers async-signal-safe Bruce Richardson
2026-09-07 17:03 ` [PATCH v2 " Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 01/13] graph: do not call printf in signal Stephen Hemminger
2026-09-07 17:03 ` Stephen Hemminger [this message]
2026-09-07 17:03 ` [PATCH v2 03/13] examples/vmdq: do not print from signal handler Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 04/13] examples/symmetric_mp: do not print or exit in handler Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 05/13] examples/vdpa: make signal handler safe Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 06/13] examples/vhost: " Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 07/13] examples/vhost_blk: do not tear down from signal handler Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 08/13] examples/ntb: do not print and re-raise " Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 09/13] examples/ipsecgw: do not print " Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 10/13] examples/l2fwd-macsec: remove print in " Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 11/13] examples/ethtool: fix exit flag and unchecked cmdline Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 12/13] examples/vmdq_dcb: allow exit on signal Stephen Hemminger
2026-09-07 17:03 ` [PATCH v2 13/13] examples/eventdev_pipeline: make signal handler safe Stephen Hemminger
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=20260907170454.351647-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=jerinj@marvell.com \
--cc=kevin.laatz@intel.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=orika@nvidia.com \
--cc=pbhagavatula@marvell.com \
--cc=skori@marvell.com \
--cc=yanzhirun_163@163.com \
/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