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 0F9B942D5F; Mon, 26 Jun 2023 20:43:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82E5542BDA; Mon, 26 Jun 2023 20:42:55 +0200 (CEST) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by mails.dpdk.org (Postfix) with ESMTP id 94EE841148 for ; Mon, 26 Jun 2023 20:42:53 +0200 (CEST) Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-39eab4bbe8aso2590099b6e.1 for ; Mon, 26 Jun 2023 11:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687804972; x=1690396972; 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=BXFQnhgwaB8ReFX0BeRWCGxQKFeLEqIvzBfOxM7c12w=; b=OeV+BfJ2J6Ub/9ldy/L3GIMtuANeTsxX7Tz2lDObTvrvuqBJSpQRIvklry8bT3DDMm DXpcS9Um4v+Taot2/InEBE0KIuaPi6a0ARGEzP5Klc1rmDkvpaVX1oxfvU70p7ZbWC6/ 2No99xP37zQqHpAUBnz80iCo3UZK9Xd71t7E94iXUq+Np43bkMcPGM0q5xIe5FJ22FZ6 /6BQwDd/3uY2oexDy1Rz9Q9QX8bTVw33KkSb5kGAGGQgl/yP3ew6CwGxYZrdLk374sCc nfPeOq0zBaaycGL8RmIndLo5uzXD7R8FupfGK53OEeqtafD0RWN8L+E/eL7laTtICO8+ Jm7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687804972; x=1690396972; 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=BXFQnhgwaB8ReFX0BeRWCGxQKFeLEqIvzBfOxM7c12w=; b=F7QZm+7N95GqeVi0GPJIt1pHL3qiroASKKw7blyXXscAAv3BInvoxF5AeemoqiRV0x WMUXtmJW3o+JHfSebAyS8N86kKfMo5ZDembqDYzG53v9jX4C4ODTUf1buFoRHhqGYpoF 0n5KHcu0YYPV9VjPq7EI7jH/9aiMmYGutkuMjyQcowJIKb01mEVCxNxPHZmBVM6N06XN CcSxM9Au7DS/ySg3Xot5RfDbiGwFcNKBkQKldn6wDP0NaATghmtL02S1AGwOMUv5x58/ RPA1i7iT8LC3M2oA1XWYo30H8BF50DxsEO0wcFchnBrFlk9Y10kU7fje+QcdhGxZpDUS LAiQ== X-Gm-Message-State: AC+VfDwtc1UEWA0BDzGHSjnCrfZtCiQjCTf+G9Ag22UpucEaMDYTCPxr F1z9vw8fO3sQLsO1WVlhb0bosBz5jHH8EgOo9E9psg== X-Google-Smtp-Source: ACHHUZ7R1MFyirV/G/ovPyL/KcKR2XKbFVoN1B2+O0L9MBurR1TNJFDcB2a4IWpRIMdkd2Ie9LgCEA== X-Received: by 2002:a05:6808:1392:b0:3a1:b2d4:5f64 with SMTP id c18-20020a056808139200b003a1b2d45f64mr12868303oiw.54.1687804972496; Mon, 26 Jun 2023 11:42:52 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id h17-20020a17090adb9100b0024e37e0a67dsm4846577pjv.20.2023.06.26.11.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 11:42:52 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Keith Wiles , Bruce Richardson , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Subject: [PATCH v4 2/5] eal: turn off getopt_long error message during eal_log_level Date: Mon, 26 Jun 2023 11:42:13 -0700 Message-Id: <20230626184223.155390-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230626184223.155390-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20230626184223.155390-1-stephen@networkplumber.org> 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 If DPDK application is given a bogus option, the error message would get printed twice. Once during scan for log level and again during parsing of arguments. Example: # ./build/app/dpdk-testpmd --bogus ./build/app/dpdk-testpmd: unrecognized option '--bogus' EAL: Detected CPU lcores: 16 EAL: Detected NUMA nodes: 1 ./build/app/dpdk-testpmd: unrecognized option '--bogus' Usage: ./build/app/dpdk-testpmd [options] Fix by suppressing printing error message on first pass. Signed-off-by: Keith Wiles Signed-off-by: Stephen Hemminger --- lib/eal/freebsd/eal.c | 2 ++ lib/eal/linux/eal.c | 2 ++ lib/eal/windows/eal.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 6df6873e3889..70087837da18 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -381,6 +381,7 @@ eal_log_level_parse(int argc, char **argv) argvopt = argv; optind = 1; optreset = 1; + opterr = 0; while ((opt = getopt_long(argc, argvopt, eal_short_options, eal_long_options, &option_index)) != EOF) { @@ -424,6 +425,7 @@ eal_parse_args(int argc, char **argv) argvopt = argv; optind = 1; optreset = 1; + opterr = 1; while ((opt = getopt_long(argc, argvopt, eal_short_options, eal_long_options, &option_index)) != EOF) { diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 145afafde234..60bb130aea15 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -561,6 +561,7 @@ eal_log_level_parse(int argc, char **argv) argvopt = argv; optind = 1; + opterr = 0; while ((opt = getopt_long(argc, argvopt, eal_short_options, eal_long_options, &option_index)) != EOF) { @@ -638,6 +639,7 @@ eal_parse_args(int argc, char **argv) argvopt = argv; optind = 1; + opterr = 1; while ((opt = getopt_long(argc, argvopt, eal_short_options, eal_long_options, &option_index)) != EOF) { diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index 2d7a0e9ab27e..0800a9e5c2d2 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -106,6 +106,8 @@ eal_log_level_parse(int argc, char **argv) struct internal_config *internal_conf = eal_get_internal_configuration(); + opterr = 0; + argvopt = argv; eal_reset_internal_config(internal_conf); @@ -143,6 +145,7 @@ eal_parse_args(int argc, char **argv) eal_get_internal_configuration(); argvopt = argv; + opterr = 1; while ((opt = getopt_long(argc, argvopt, eal_short_options, eal_long_options, &option_index)) != EOF) { -- 2.39.2