From patchwork Fri Dec 4 17:51:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prateek Agarwal X-Patchwork-Id: 84756 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23142A09E0; Fri, 4 Dec 2020 18:52:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7D25034F3; Fri, 4 Dec 2020 18:52:17 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by dpdk.org (Postfix) with ESMTP id 2C1453256 for ; Fri, 4 Dec 2020 18:52:15 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id y10so2061551plr.10 for ; Fri, 04 Dec 2020 09:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Mpfvo2pNAIB1vJLU6snVXddV/MZSXWWGIarhuf85/wI=; b=a0sNgrldaszaGW6tqrlFI6DrkdceqPKlesfLezmz7iCE+Ah96Eo5JcP5sB5Mppbo3n P4tdPbh8yNUkzsghBfaUm2bQcqJ8oTQcj8Sk5dKwBA1HYAdQ8F4FAFP85ZrwDXOQjsAU Vs6LlntyO/2g1uRCS/XgEdThVHHHdWT70RlFt9r5kG9+ay4Uk8S66wMRSsXRSUl+gbvx zkBlY6hqzBPCzsGbAWkS1CjGoeNNu6Cvu6x5bS2tSHfvEEVisVulVzRSR/UXw2K4aW8f K58QuIJ8TIjuOJAKE0e4L9lv4bDC2q5/EC+Jr8afxAFfI84JNLQ/CCBhZhqaWS8dyXoQ 8rOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Mpfvo2pNAIB1vJLU6snVXddV/MZSXWWGIarhuf85/wI=; b=Q5MAfh7BGTGAu6ttSSmsKHj4FhoLz6QBffBJ2bpJBQUtTYBSM0Lz9vwlc13LnbMUpx LifjeC7aV6sHAzj2dsB+BXY33kqiUqy4tRGD65Zopmi1pg0zmiGgJBeliPNPk3KLh2fH 5RnPk26OsR1jwoQF6zLK6bUlEoaLIHfiBSybXFdQyUi0jPPSsZcWWYDvU1g1O9PSFBvH UXRuvu+G8hUVXrriU9mPZIUm8b9dNR/XaTa32M2VQxNIng5mRa9Zu60G52WNxkm6ma0k kqoXN1qQWQxx9VsBroa3LSJozCD+S+Ca9TGjgKfb4lYxPEhdBvLBnZapjwgxdC06Y8ac hSNg== X-Gm-Message-State: AOAM532RKswKIT+Pa/uNCJu2oj3uqvycmveo7t8Il+gq9ZxGBJ6ySWjz z2UEl1phw+Yn01cYXdnza16vsHhE3rQHqg== X-Google-Smtp-Source: ABdhPJx05iwkVEM6wZwJyYRn53GJFtR/BAeiByj7igNYdZCugsQl5A6aTY0ljFGrWrUp58z719qWaA== X-Received: by 2002:a17:902:9681:b029:da:5be1:ec53 with SMTP id n1-20020a1709029681b02900da5be1ec53mr5018024plp.62.1607104333866; Fri, 04 Dec 2020 09:52:13 -0800 (PST) Received: from localhost.localdomain ([106.215.29.54]) by smtp.gmail.com with ESMTPSA id r130sm5762290pfc.41.2020.12.04.09.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 09:52:13 -0800 (PST) From: Prateek Agarwal To: dev@dpdk.org Cc: thomas@monjalon.net, Prateek Agarwal , Prateek Agarwal Date: Fri, 4 Dec 2020 23:21:51 +0530 Message-Id: <20201204175151.11868-1-pratekag@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] Remove printf from signal handler. 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" printf is not async-signal safe. Using printf in signal handlers may lead to deadlock. Removed printf from signal handlers present in several applications. Signed-off-by: Prateek Agarwal --- app/pdump/main.c | 2 -- app/test-eventdev/evt_main.c | 4 ---- app/test-flow-perf/main.c | 3 --- app/test-pmd/testpmd.c | 2 -- app/test/test_pmd_perf.c | 1 - 5 files changed, 12 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index b34bf3353..380f0ea0f 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -573,8 +573,6 @@ static void signal_handler(int sig_num) { if (sig_num == SIGINT) { - printf("\n\nSignal %d received, preparing to exit...\n", - sig_num); quit_signal = 1; } } diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c index a8d304bab..51d5897f8 100644 --- a/app/test-eventdev/evt_main.c +++ b/app/test-eventdev/evt_main.c @@ -22,12 +22,8 @@ signal_handler(int signum) { int i; static uint8_t once; - if ((signum == SIGINT || signum == SIGTERM) && !once) { once = true; - printf("\nSignal %d received, preparing to exit...\n", - signum); - if (test != NULL) { /* request all lcores to exit from the main loop */ *(int *)test->test_priv = true; diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index 03d01a8b5..aeb0ef3b0 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -1001,9 +1001,6 @@ static void signal_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) { - printf("\n\nSignal %d received, preparing to exit...\n", - signum); - printf("Error: Stats are wrong due to sudden signal!\n\n"); force_quit = true; } } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 33fc0fddf..7ec87e7fd 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3794,8 +3794,6 @@ static void signal_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) { - printf("\nSignal %d received, preparing to exit...\n", - signum); #ifdef RTE_LIB_PDUMP /* uninitialize packet capture framework */ rte_pdump_uninit(); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 4db816a36..58cb84401 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -319,7 +319,6 @@ signal_handler(int signum) { /* USR1 signal, stop testing */ if (signum == SIGUSR1) { - printf("Force Stop!\n"); stop = 1; }