Standard conforming signal handling in applications should use sig_atomic_t
for flags set by signal handler.
 https://www.gnu.org/software/libc/manual/html_node/Atomic-Data-Access.html

This is really just a fancy way of saying ''int'' but adds
to platform portablilty for DPDK.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 app/test-pmd/testpmd.c | 6 +-----
 app/test-pmd/testpmd.h | 3 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5cb6f9252395..aee926571f53 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -228,11 +228,7 @@ struct rte_eth_xstat_name *xstats_display;
 
 unsigned int xstats_display_num; /**< Size of extended statistics to show */
 
-/*
- * In container, it cannot terminate the process which running with 
'stats-period'
- * option. Set flag to exit stats period loop after received SIGINT/SIGTERM.
- */
-volatile uint8_t f_quit;
+volatile sig_atomic_t f_quit;  /* Quit testpmd from signal */
 uint8_t cl_quit; /* Quit testpmd from cmdline. */
 
 /*
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index bdfbfd36d3c5..5c11d4f86301 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -6,6 +6,7 @@
 #define _TESTPMD_H_
 
 #include <stdbool.h>
+#include <signal.h>
 
 #ifdef RTE_LIB_GRO
 #include <rte_gro.h>
@@ -34,7 +35,7 @@
 #define RTE_PORT_HANDLING       (uint16_t)3
 
 extern uint8_t cl_quit;
-extern volatile uint8_t f_quit;
+extern volatile sig_atomic_t f_quit;
 
 /*
  * It is used to allocate the memory for hash key.
-- 
2.39.2

Reply via email to