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 D34A4A0547 for ; Fri, 28 May 2021 11:21:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA257410FC; Fri, 28 May 2021 11:21:44 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id D1D95410FC for ; Fri, 28 May 2021 11:21:43 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 7424A5C0135; Fri, 28 May 2021 05:21:42 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 28 May 2021 05:21:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=b7u5O5yLCEXBoNDSk1hrA4nqpp bvWkZY+//RWAOIZ9c=; b=L/kaAqVTLJSeyRtrnwmFJGrwiBT8hVekkF/KRlqEcu KNnRiez85v54t6pZLtztGMGnx886WWeRjJT7U71sL+9XMKVwxkzWOr1Q4v2Y+QlS TRo8p6QOXhU5kausWG3wtKiDAEKtA7C26oM7HXbQBgKMfe99MjpmTNLxrO2k4o7l GGhXDwts0iFdcVly2xpBecvsBTo/53yuA0AUVFMg+NTN2OmVm/6NdBkG3OaS2KJr f2WVVocCZmBfFWNIgHEW9DF5e53t9oPYuaoL5jdcot0DGzEGNA3oVgtjXsb2alvh kexO8cvopuqiNlU4I2hwM11PmSeHtamWt3hg6MEZpkgQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=b7u5O5yLCEXBoNDSk 1hrA4nqppbvWkZY+//RWAOIZ9c=; b=OUrBqD+GLsQRg7QAMf4tNwfT9gqEBErPq s2Q95oXVyOjCIduuys1iQ8OC6gjAXTTbu/eNmyx/2+zaz/2uX9qomrLZ8pMvCMIS p1o3uhsdyKwe7aCJ8UAHSnd3JVh6lHddogIZtYB8KuXdxQXgD0IRWSFesFW/S6HR clFWATwaLsPEnI21O9J4jstt1RNKMsQa0/bE7mZp0ki5LCzrU1x8/tEN4PJ07f06 bcMpc9q9XdQLUPBv3mBiR4VJfri4dxTzcGpcifuWHwZ+JyV1Dk3BrZp1yjlv3Lp3 nRFMfHDwh673+rPd+jw/sLhB+JYi/ainiGSBfrUk2H5v2DRbVK2xg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdekjedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgrshcu ofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecuggftrf grthhtvghrnhepvdelvdduhedvudduveeuvdevheegudelgeeigfejheduhedttdegudff jeeihffgnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghrufhiii gvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhn rdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 28 May 2021 05:21:41 -0400 (EDT) From: Thomas Monjalon To: stable@dpdk.org Cc: xuemingl@nvidia.com, Wisam Jaddo , Ori Kam , Bruce Richardson , Andrew Rybchenko , David Marchand Date: Fri, 28 May 2021 11:21:34 +0200 Message-Id: <20210528092134.19628-1-thomas@monjalon.net> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH 20.11] app: fix exit messages X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit 487cfc24370fdb7ea843aa510d6e6d2a7212dd23 ] Some applications were printing useless messages with rte_exit() after showing the help. Using exit() is enough in this case. Some applications were using a redundant printf or fprintf() before calling rte_exit(). The messages are unified in a single rte_exit(). Some rte_exit() calls were missing a line feed or returning a wrong code. Signed-off-by: Thomas Monjalon Acked-by: Wisam Jaddo Acked-by: Ori Kam Acked-by: Bruce Richardson Acked-by: Andrew Rybchenko Acked-by: David Marchand --- .../comp_perf_options_parse.c | 2 +- app/test-crypto-perf/cperf_options_parsing.c | 2 +- app/test-flow-perf/main.c | 45 +++++++++---------- app/test-pmd/parameters.c | 4 +- app/test-regex/main.c | 3 +- 5 files changed, 26 insertions(+), 30 deletions(-) diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c index 04a8d2fbee..019eddb7bd 100644 --- a/app/test-compress-perf/comp_perf_options_parse.c +++ b/app/test-compress-perf/comp_perf_options_parse.c @@ -620,7 +620,7 @@ comp_perf_options_parse(struct comp_test_data *test_data, int argc, char **argv) switch (opt) { case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; /* long options */ case 0: diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 0466f7baf8..40b6dfb648 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -983,7 +983,7 @@ cperf_options_parse(struct cperf_options *options, int argc, char **argv) switch (opt) { case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; /* long options */ case 0: diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c index e2fc5b7f65..64d722baa7 100644 --- a/app/test-flow-perf/main.c +++ b/app/test-flow-perf/main.c @@ -606,7 +606,7 @@ args_parse(int argc, char **argv) case 0: if (strcmp(lgopts[opt_idx].name, "help") == 0) { usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); } if (strcmp(lgopts[opt_idx].name, "group") == 0) { @@ -614,7 +614,7 @@ args_parse(int argc, char **argv) if (n >= 0) flow_group = n; else - rte_exit(EXIT_SUCCESS, + rte_exit(EXIT_FAILURE, "flow group should be >= 0\n"); printf("group %d / ", flow_group); } @@ -634,7 +634,7 @@ args_parse(int argc, char **argv) if (n > 0) hairpin_queues_num = n; else - rte_exit(EXIT_SUCCESS, + rte_exit(EXIT_FAILURE, "Hairpin queues should be > 0\n"); flow_actions[actions_idx++] = @@ -647,7 +647,7 @@ args_parse(int argc, char **argv) if (n > 0) hairpin_queues_num = n; else - rte_exit(EXIT_SUCCESS, + rte_exit(EXIT_FAILURE, "Hairpin queues should be > 0\n"); flow_actions[actions_idx++] = @@ -671,11 +671,9 @@ args_parse(int argc, char **argv) break; } /* Reached last item with no match */ - if (i == (RTE_DIM(flow_options) - 1)) { - fprintf(stderr, "Invalid encap item: %s\n", token); - usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Invalid encap item\n"); - } + if (i == (RTE_DIM(flow_options) - 1)) + rte_exit(EXIT_FAILURE, + "Invalid encap item: %s\n", token); } token = strtok(NULL, ","); } @@ -697,11 +695,9 @@ args_parse(int argc, char **argv) break; } /* Reached last item with no match */ - if (i == (RTE_DIM(flow_options) - 1)) { - fprintf(stderr, "Invalid decap item: %s\n", token); - usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Invalid decap item\n"); - } + if (i == (RTE_DIM(flow_options) - 1)) + rte_exit(EXIT_FAILURE, + "Invalid decap item %s\n", token); } token = strtok(NULL, ","); } @@ -714,9 +710,9 @@ args_parse(int argc, char **argv) if (n >= DEFAULT_RULES_BATCH) rules_batch = n; else { - printf("\n\nrules_batch should be >= %d\n", + rte_exit(EXIT_FAILURE, + "rules_batch should be >= %d\n", DEFAULT_RULES_BATCH); - rte_exit(EXIT_SUCCESS, " "); } } if (strcmp(lgopts[opt_idx].name, @@ -725,7 +721,8 @@ args_parse(int argc, char **argv) if (n >= (int) rules_batch) rules_count = n; else { - printf("\n\nrules_count should be >= %d\n", + rte_exit(EXIT_FAILURE, + "rules_count should be >= %d\n", rules_batch); } } @@ -752,9 +749,9 @@ args_parse(int argc, char **argv) } break; default: - fprintf(stderr, "Invalid option: %s\n", argv[optind]); usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Invalid option\n"); + rte_exit(EXIT_FAILURE, "Invalid option: %s\n", + argv[optind]); break; } } @@ -853,7 +850,7 @@ destroy_flows(int port_id, struct rte_flow **flow_list) memset(&error, 0x33, sizeof(error)); if (rte_flow_destroy(port_id, flow_list[i], &error)) { print_flow_error(error); - rte_exit(EXIT_FAILURE, "Error in deleting flow"); + rte_exit(EXIT_FAILURE, "Error in deleting flow\n"); } if (i && !((i + 1) % rules_batch)) { @@ -924,7 +921,7 @@ flows_handler(void) flow_list = rte_zmalloc("flow_list", (sizeof(struct rte_flow *) * rules_count) + 1, 0); if (flow_list == NULL) - rte_exit(EXIT_FAILURE, "No Memory available!"); + rte_exit(EXIT_FAILURE, "No Memory available!\n"); for (port_id = 0; port_id < nr_ports; port_id++) { /* If port outside portmask */ @@ -947,7 +944,7 @@ flows_handler(void) if (flow == NULL) { print_flow_error(error); - rte_exit(EXIT_FAILURE, "error in creating flow"); + rte_exit(EXIT_FAILURE, "Error in creating flow\n"); } flow_list[flow_index++] = flow; } @@ -968,7 +965,7 @@ flows_handler(void) if (!flow) { print_flow_error(error); - rte_exit(EXIT_FAILURE, "error in creating flow"); + rte_exit(EXIT_FAILURE, "Error in creating flow\n"); } flow_list[flow_index++] = flow; @@ -1087,7 +1084,7 @@ packet_per_second_stats(void) old = rte_zmalloc("old", sizeof(struct lcore_info) * MAX_LCORES, 0); if (old == NULL) - rte_exit(EXIT_FAILURE, "No Memory available!"); + rte_exit(EXIT_FAILURE, "No Memory available!\n"); memcpy(old, lcore_infos, sizeof(struct lcore_info) * MAX_LCORES); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index df5eb10d84..195a6ae9d8 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -630,7 +630,7 @@ launch_args_parse(int argc, char** argv) case 0: /*long options */ if (!strcmp(lgopts[opt_idx].name, "help")) { usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); } #ifdef RTE_LIB_CMDLINE if (!strcmp(lgopts[opt_idx].name, "interactive")) { @@ -1359,7 +1359,7 @@ launch_args_parse(int argc, char** argv) break; case 'h': usage(argv[0]); - rte_exit(EXIT_SUCCESS, "Displayed help\n"); + exit(EXIT_SUCCESS); break; default: usage(argv[0]); diff --git a/app/test-regex/main.c b/app/test-regex/main.c index ac6152dea7..507b9cf912 100644 --- a/app/test-regex/main.c +++ b/app/test-regex/main.c @@ -108,9 +108,8 @@ args_parse(int argc, char **argv, char *rules_file, char *data_file, usage("RegEx test app"); break; default: - fprintf(stderr, "Invalid option: %s\n", argv[optind]); usage("RegEx test app"); - rte_exit(EXIT_FAILURE, "Invalid option\n"); + rte_exit(EXIT_FAILURE, "Invalid option: %s\n", argv[optind]); break; } } -- 2.31.1