DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: "Wiles, Keith" <keith.wiles@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] examples: optind should be reset to one not zero
Date: Fri, 10 Mar 2017 15:41:05 +0100	[thread overview]
Message-ID: <5516131.2JN5YXhbWQ@xps13> (raw)
In-Reply-To: <C52165FD-807E-4B8B-AB87-6BCE20C2B1D3@intel.com>

2017-03-09 21:11, Wiles, Keith:
> 
> > On Mar 9, 2017, at 2:41 PM, Thomas Monjalon <thomas.monjalon@6wind.com> wrote:
> > 
> > 2017-02-14 16:09, Keith Wiles:
> >> Signed-off-by: Keith Wiles <keith.wiles@intel.com>
> > 
> > Please, could explain and describe what was the consequence of this
> > wrong reset value?
> > You can just reply and I will integrate it in the commit when applying.
> 
> Here is the man page text:
> 
> "The variable optind is the index of the next element to be processed in argv.  The system initializes this  value  to  1.
> The caller can reset it to 1 to restart scanning of the same argv, or when scanning a new argument vector.”
> 
> The problem I saw with my application was trying to parse the wrong option, which can happen as DPDK parses the first part of the command line and the application parses the second part. If you call getopt() multiple times in the same execution, the behavior is not maintained when using zero for optind.
> 
> 
> — Do not put the next part in the commit message unless you want — 
> As a side note it appears MacOS is much more picky about trying to use optind of zero and not one. I would get a segfault on DPDK running in MacOS and I assumed Linux/FreeBSD could be fixing optind internally, but it is best to set the correct value in all cases.
> 
> I hope that helps.

Applied with this explanation integrated, thanks.

      reply	other threads:[~2017-03-10 14:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 22:09 Keith Wiles
2017-03-09 20:41 ` Thomas Monjalon
2017-03-09 21:11   ` Wiles, Keith
2017-03-10 14:41     ` Thomas Monjalon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5516131.2JN5YXhbWQ@xps13 \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).