DPDK patches and discussions
 help / color / mirror / Atom feed
From: <vattunuru@marvell.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <david.marchand@redhat.com>,
	<thomas@monjalon.net>, Vamsi Attunuru <vattunuru@marvell.com>
Subject: [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add SIGTERM signal handling
Date: Thu, 6 Feb 2020 17:23:57 +0530	[thread overview]
Message-ID: <20200206115357.19827-1-vattunuru@marvell.com> (raw)
In-Reply-To: <20200204084214.18801-1-vattunuru@marvell.com>

From: Vamsi Attunuru <vattunuru@marvell.com>

SIGTERM handling is added for graceful application exit.
Useful when application is terminated without specifying
any signal on 'kill' command.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2 Change:
* Changed commit log

 examples/kni/main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 5f713e6..29fc37e 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -176,9 +176,13 @@ signal_handler(int signum)
 		return;
 	}
 
-	/* When we receive a RTMIN or SIGINT signal, stop kni processing */
-	if (signum == SIGRTMIN || signum == SIGINT){
-		printf("\nSIGRTMIN/SIGINT received. KNI processing stopping.\n");
+	/*
+	 * When we receive a RTMIN or SIGINT or SIGTERM signal,
+	 * stop kni processing
+	 */
+	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
+		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
+			"KNI processing stopping.\n");
 		rte_atomic32_inc(&kni_stop);
 		return;
         }
@@ -1006,6 +1010,7 @@ main(int argc, char** argv)
 	signal(SIGUSR2, signal_handler);
 	signal(SIGRTMIN, signal_handler);
 	signal(SIGINT, signal_handler);
+	signal(SIGTERM, signal_handler);
 
 	/* Initialise EAL */
 	ret = rte_eal_init(argc, argv);
-- 
2.8.4


  parent reply	other threads:[~2020-02-06 11:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  8:42 [dpdk-dev] [PATCH] [v1 1/1] examples/kni: fix " vattunuru
2020-02-04 13:37 ` Ferruh Yigit
2020-02-06 11:53 ` vattunuru [this message]
2020-02-13 17:36   ` [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add " David Marchand

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=20200206115357.19827-1-vattunuru@marvell.com \
    --to=vattunuru@marvell.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    /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).