DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tiwei Bie <btw@mail.ustc.edu.cn>
To: Don Provan <dprovan@bivio.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] eal/bsd: reinitialize optind and optreset to 1
Date: Thu, 15 Oct 2015 09:40:43 +0800	[thread overview]
Message-ID: <20151015014043.GA55827@dell> (raw)
In-Reply-To: <CY1PR0101MB0987AD430B8C4AB496057011A03F0@CY1PR0101MB0987.prod.exchangelabs.com>

Hi Don!

I'm truly sorry for my misunderstanding. :-(
Thank you so much for your detailed comments!

I will update my patch!

Thanks again!

Best wishes,
Tiwei Bie

On Wed, Oct 14, 2015 at 05:54:14PM +0000, Don Provan wrote:
> > > On Wed, Oct 14, 2015 at 10:28:44AM +0800, Tiwei Bie wrote:
> > > > It is designed to have DPDK's parameters specified in the front of the
> > > > cmd line and terminated by '--'.
> 
> In other words, it is designed assuming the DPDK library can dictate
> the application's command line. This is an incorrect assumption
> that should be eliminated.
> 
> I don't think I'm the only one that has figured out that layering a
> service on top of DPDK requires creating a fake argc/argv array.
> The original plan of having rte_eal_init() parse the actual application
> command line organized as dictated by DPDK is not reasonable.
> 
> > > > And 1 or 0 are not some
> > > > arbitrary values. They are used to put the index back to the beginning
> > > > of the new argv[] array.
> 
> They're arbitrary values from the point of view of the calling
> application. If the caller is using getopt() for its own purposes,
> it has every reason to expect optind to have the same value
> after the call to rte_eal_init() that it had before, not some
> other value that the DPDK library happened to think was
> useful.
> 
> > > > We shouldn't mix up DPDK's parameters and application's parameters.
> > > > And we should group them using '--'.
> 
> Exactly! Yet we do confuse the two by using getopt() without considering
> that the application's parameters might not be in the argc/argv list that's
> passed to rte_eal_init().
> 
> > I'm considering updating optind to make it point to the option after
> > '--' before eal_parse_args() returns, and eal_parse_args() will return
> > 0 to avoid breaking the current applications which use the return value
> > of rte_eal_init() to update argc/argv.
> >
> > Any comments? Thanks! :-)
> 
> Don't do it. Last time I looked, optind wasn't even mentioned in the
> documentation. Even if I thought it was reasonable to change it,
> I would still argue against using it as an undocumented return
> value, particularly when the documented return value works fine.
> 
> -don provan
> dprovan@bivio.net

      reply	other threads:[~2015-10-15  1:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13  8:54 [dpdk-dev] [PATCH] Found a bug related to getopt() in eal/bsd module Tiwei Bie
2015-10-13  8:54 ` [dpdk-dev] [PATCH] eal/bsd: reinitialize optind and optreset to 1 Tiwei Bie
2015-10-13 14:58   ` Bruce Richardson
2015-10-13 17:14   ` Don Provan
     [not found]     ` <20151014022843.GA26774@dell>
2015-10-14  9:31       ` Bruce Richardson
2015-10-14 10:19         ` Tiwei Bie
2015-10-14 11:28           ` Tiwei Bie
2015-10-14 17:54             ` Don Provan
2015-10-15  1:40               ` Tiwei Bie [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=20151015014043.GA55827@dell \
    --to=btw@mail.ustc.edu.cn \
    --cc=dev@dpdk.org \
    --cc=dprovan@bivio.net \
    /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).