From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DFE1542C9B; Tue, 13 Jun 2023 02:11:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69A8240C35; Tue, 13 Jun 2023 02:11:55 +0200 (CEST) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 89D5340698 for ; Tue, 13 Jun 2023 02:11:53 +0200 (CEST) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1b3d0b33dc2so10696695ad.0 for ; Mon, 12 Jun 2023 17:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1686615112; x=1689207112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hjNsZuIuMkx9MD/CmBUv4Dl8BzzkjhmHNyLBXbGv/wI=; b=xHXFsWUHknU82ELohYvmtAPz9+23yEoHOyyfM3cd9f1D3aMnsbrhKGwzeIVerrhbSl idjcVHKoSfVXRpZDXDq3QpDVTYctiQCV4AUfzJjVkCewzwEOj6ha/PLbTYhBgtRK41LP 3WLgqSte6d7zEUTIAYVp8OD62dZhItvoEie1XZ+XH8OUi2yDEK61cVk1AbethRQIkLrf mCiY60TIJ4twBtl7IcSF100uUqipIsKgSbuh8BRw3IvEfqn5UaYVFYavM93d07KAW/Dx Hj1v0n/UmqfxzDgHhjcNgc4aR3eTHSQE09diPBJIFc42vUg8z8CmUj3FUTtU5O3e8CYw 6BNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686615112; x=1689207112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hjNsZuIuMkx9MD/CmBUv4Dl8BzzkjhmHNyLBXbGv/wI=; b=RQ60Tkdtv/8AmPp4V3Bf4jNATB+t6k8P2nt6j0uq21lpXAXprRXFjsT8mUXhN60dKO b007RI3sEG6z0RgMOj2t2UWqkmartECDZuhasGTPQTSpfwz7xMD3wV+NuGPMM7aNdg5x /XIL3LstZtebitzCW2XdpaHLe+OyuebDHtGzfKD8IywwfvuU8K1rbt7gfIUV9Eu1HuL0 NIaP29FXMx8BZUT4GDeaXGuH0mFg2lA1jGcoD3QbNWZFrhW5Jvo4No5vvEU7UdsfrNQE uRNDB+Xfq+CYDlJGhEARL/ejcO7EuR/LGUwfXaOhWffE8mT7Cxl/7Aw9AwZxMc/8DbQf sU7w== X-Gm-Message-State: AC+VfDzoigKnO393KV/zqedZv1SVYPFQnJO3qlXCKD1c5W86WGJTZVgz vA+4BksYivHWDdsmcvF237aMzA== X-Google-Smtp-Source: ACHHUZ56Or1VFqIoz0eKTpehG7VexXB/SIQlr46RaJgNHZybi8hEck283A2dl5ZhfOFe8CUwgOnIrw== X-Received: by 2002:a17:902:d4c7:b0:1ad:7bc5:b9ea with SMTP id o7-20020a170902d4c700b001ad7bc5b9eamr8880740plg.60.1686615112432; Mon, 12 Jun 2023 17:11:52 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id jw22-20020a170903279600b001b3dada0e78sm1854600plb.258.2023.06.12.17.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 17:11:52 -0700 (PDT) From: Stephen Hemminger To: prateekag@cse.iitb.ac.in Cc: dev@dpdk.org, Stephen Hemminger Subject: [PATCH] app: do not call printf in signal handlers Date: Mon, 12 Jun 2023 17:11:50 -0700 Message-Id: <20230613001150.65407-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20201204175151.11868-1-pratekag@gmail.com> References: <20201204175151.11868-1-pratekag@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Using printf is not async-signal safe and worst case may lead to deadlock. Remove printf from signal handlers present in several applications. Testpmd was already fixed by commit 0fd1386c30c3 ("app/testpmd: cleanup cleanly from signal") Signed-off-by: Prateek Agarwal Signed-off-by: Stephen Hemminger --- app/pdump/main.c | 2 -- app/test-eventdev/evt_main.c | 3 --- app/test-flow-perf/main.c | 3 --- app/test/test_pmd_perf.c | 1 - 4 files changed, 9 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index c6cf9d9c8769..c94606275b28 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -571,8 +571,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 5c7ac2cce9ab..13a8500ef730 100644 --- a/app/test-eventdev/evt_main.c +++ b/app/test-eventdev/evt_main.c @@ -21,9 +21,6 @@ static void signal_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) { - 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 e0ef78a84013..e224ef67983d 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -1708,9 +1708,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/test_pmd_perf.c b/app/test/test_pmd_perf.c index ff84d251ff5f..3ef590cb517d 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -318,7 +318,6 @@ signal_handler(int signum) { /* USR1 signal, stop testing */ if (signum == SIGUSR1) { - printf("Force Stop!\n"); stop = 1; } -- 2.39.2