From: Stephen Hemminger <stephen@networkplumber.org>
To: prateekag@cse.iitb.ac.in
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH] app: do not call printf in signal handlers
Date: Mon, 12 Jun 2023 17:11:50 -0700 [thread overview]
Message-ID: <20230613001150.65407-1-stephen@networkplumber.org> (raw)
In-Reply-To: <20201204175151.11868-1-pratekag@gmail.com>
Using printf is not async-signal safe and worst case may lead to deadlock.
Remove printf from signal handlers present in several applications.
Testpmd was already fixed by
commit 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal")
Signed-off-by: Prateek Agarwal <prateekag@cse.iitb.ac.in>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/pdump/main.c | 2 --
app/test-eventdev/evt_main.c | 3 ---
app/test-flow-perf/main.c | 3 ---
app/test/test_pmd_perf.c | 1 -
4 files changed, 9 deletions(-)
diff --git a/app/pdump/main.c b/app/pdump/main.c
index c6cf9d9c8769..c94606275b28 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -571,8 +571,6 @@ static void
signal_handler(int sig_num)
{
if (sig_num == SIGINT) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- sig_num);
quit_signal = 1;
}
}
diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
index 5c7ac2cce9ab..13a8500ef730 100644
--- a/app/test-eventdev/evt_main.c
+++ b/app/test-eventdev/evt_main.c
@@ -21,9 +21,6 @@ static void
signal_handler(int signum)
{
if (signum == SIGINT || signum == SIGTERM) {
- printf("\nSignal %d received, preparing to exit...\n",
- signum);
-
if (test != NULL) {
/* request all lcores to exit from the main loop */
*(int *)test->test_priv = true;
diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index e0ef78a84013..e224ef67983d 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -1708,9 +1708,6 @@ static void
signal_handler(int signum)
{
if (signum == SIGINT || signum == SIGTERM) {
- printf("\n\nSignal %d received, preparing to exit...\n",
- signum);
- printf("Error: Stats are wrong due to sudden signal!\n\n");
force_quit = true;
}
}
diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index ff84d251ff5f..3ef590cb517d 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -318,7 +318,6 @@ signal_handler(int signum)
{
/* USR1 signal, stop testing */
if (signum == SIGUSR1) {
- printf("Force Stop!\n");
stop = 1;
}
--
2.39.2
next prev parent reply other threads:[~2023-06-13 0:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-04 17:51 [dpdk-dev] [PATCH] Remove printf from signal handler Prateek Agarwal
2020-12-08 2:58 ` Li, Xiaoyun
2020-12-10 0:28 ` prateekag
2020-12-10 3:14 ` Li, Xiaoyun
2020-12-10 9:24 ` Ananyev, Konstantin
2020-12-11 13:38 ` prateekag
2023-06-13 0:11 ` Stephen Hemminger [this message]
2023-06-15 20:14 ` [PATCH] app: do not call printf in signal handlers Tyler Retzlaff
2023-06-28 0:44 ` Thomas Monjalon
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=20230613001150.65407-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=prateekag@cse.iitb.ac.in \
/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;
as well as URLs for NNTP newsgroup(s).