From: Vamsi Attunuru Date: Thu, 6 Feb 2020 11:53:57 +0000 (+0530) Subject: examples/kni: add SIGTERM signal handling X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2a115479c6361f9667efaa30ceb0dbdcbd931f48;p=dpdk.git examples/kni: add SIGTERM signal handling 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 Acked-by: Ferruh Yigit --- diff --git a/examples/kni/main.c b/examples/kni/main.c index 5f713e6b22..29fc37e1fb 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);