From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8BC8EA053B; Thu, 6 Feb 2020 12:54:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0FEEB1C0D4; Thu, 6 Feb 2020 12:54:19 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 991A01C0B9 for ; Thu, 6 Feb 2020 12:54:17 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 016Bo9fx008209; Thu, 6 Feb 2020 03:54:16 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=Izul/gINcZBbb/Ywa15XDn9JSxEb7Ey9Qzku19Sa3a8=; b=JWuynAq4QMqUrmEyJ891am00qhhRp4Y1M+j5ewGS3EbV95uc0Td6To7V/YdwMbJ+OKcf K0PReF3Z0Dbz4XN9yPZPmvQR+034KINzx5vK9leO1twl7WvvJLEd7+g20nKrXHcuuyu7 OKp05cKgjqidoxio0nyxgPt9Asjh0r4yxICjIR5bfMmaN18xC+b8hxXEt1/8dUiPxU1L PC+ociqvV2MTB3CkknIONDfEYNnGu9Atd5su7QQVmdmm7vtCQGod9sEzZyDJKkWzdcjs RjpxFQct5qgN0WgZT6GNTgPFtbPW7hcZZrVo1Yt3X70u+LzdsgXGuvrO7ZDbfU1HWWm5 1A== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2xyhn17d16-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 06 Feb 2020 03:54:16 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 Feb 2020 03:54:14 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 Feb 2020 03:54:14 -0800 Received: from hyd1vattunuru-dt.caveonetworks.com (unknown [10.29.52.72]) by maili.marvell.com (Postfix) with ESMTP id 190413F7040; Thu, 6 Feb 2020 03:54:12 -0800 (PST) From: To: CC: , , , Vamsi Attunuru Date: Thu, 6 Feb 2020 17:23:57 +0530 Message-ID: <20200206115357.19827-1-vattunuru@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20200204084214.18801-1-vattunuru@marvell.com> References: <20200204084214.18801-1-vattunuru@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-06_01:2020-02-06, 2020-02-06 signatures=0 Subject: [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add SIGTERM signal handling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Vamsi Attunuru 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 --- 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