summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorsongyanchao <[email protected]>2023-09-06 02:44:19 +0000
committersongyanchao <[email protected]>2023-09-06 02:50:52 +0000
commit26036462f311b36343cb61732606b1930822713a (patch)
tree267e6925651c1de349a67e78e2a079f769bd9f14 /tools
parent0c3815168e0c4ab90e2eb06f857421bbb7c96d45 (diff)
🎈 perf(TSG-16785): mrpdump 添加SIGHUP、SIGTERM信号捕获
mrpdump 添加SIGHUP、SIGTERM信号捕获
Diffstat (limited to 'tools')
-rw-r--r--tools/tcpdump/pdump.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/tcpdump/pdump.c b/tools/tcpdump/pdump.c
index 1afcb03..3c6065c 100644
--- a/tools/tcpdump/pdump.c
+++ b/tools/tcpdump/pdump.c
@@ -682,7 +682,7 @@ static inline void pdump_rxtx(struct rte_mempool * mp, uint16_t port_id, struct
static void signal_handler(int sig_num)
{
- if (sig_num == SIGINT)
+ if ((sig_num == SIGINT) || (sig_num == SIGTERM) || (sig_num == SIGHUP))
{
fprintf(stderr, "\n\nSignal %d received, preparing to exit...\n", sig_num);
quit_signal = 1;
@@ -1099,6 +1099,8 @@ int main(int argc, char ** argv)
/* catch ctrl-c so we can print on exit */
signal(SIGINT, signal_handler);
+ signal(SIGTERM, signal_handler);
+ signal(SIGHUP, signal_handler);
argp[0] = argv[0];
argp[1] = c_flag;