DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Jerin Jacob <jerinjacobk@gmail.com>
Cc: dpdk-dev <dev@dpdk.org>, Pallavi Kadam <pallavi.kadam@intel.com>,
	Narcisa Ana Maria Vasile <Narcisa.Vasile@microsoft.com>,
	Ranjit Menon <ranjit.menon@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Jerin Jacob <jerinj@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>,
	Omar Cardona <ocardona@microsoft.com>,
	David Marchand <david.marchand@redhat.com>
Subject: Re: [dpdk-dev] [PATCH 2/2] eal/windows: fix build by supporting trace
Date: Sun, 26 Apr 2020 15:50:54 +0300	[thread overview]
Message-ID: <20200426155054.6a757920@Sovereign> (raw)
In-Reply-To: <CALBAE1O_zgcrcwD2+phn+8WhPCeFb4C2_=eRHg0Hqes1sAHHfA@mail.gmail.com>

On 2020-04-26 17:53 GMT+0530 Jerin Jacob wrote:
> On Sun, Apr 26, 2020 at 5:32 PM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
> >
> > On 2020-04-26 17:02 GMT+0530 Jerin Jacob wrote:  
> > > > +/**
> > > > + * Get absolute path to the directory where permanent data can be stored.
> > > > + *
> > > > + * @return
> > > > + *  Statically allocated string on success, NULL on failure.
> > > > + */
> > > > +const char *
> > > > +eal_permanent_data_path(void);  
> > >
> > > Do windows have PATH_MAX kind of macro? I think, it is better API
> > > consumer allocates
> > > the memory of size PATH_MAX and implementation fills it, instead of,
> > > the static scheme.  
> >
> > This API falls in line with rte_eal_get_runtime_dir() and other
> > eal_filesystem.h functions, that use static scheme. Logically, its result
> > never changes. It is race-free and is only called during initialization. What
> > you propose can be done, but are there any benefits?  
> 
> I thought who will free that memory? It looks like libc creating a static memory
> for this item. so, your current eal_permanent_data_path() declarations
> looks good to
> me.

Actually, your concern is valid (see man quotes below). Windows implementation
has no such issue because of its own static buffer. I'd use static scheme
in EAL interface for convenience, but change Unix implementation to copy
string returned by libc into a static buffer.

man 3 getenv:
	The string pointed to by the return value of getenv() may be
	statically allocated, and can be modified by a subsequent call to
	getenv(), putenv(3), setenv(3), or unsetenv(3).

man 3 getpwuid:
	The return value may point to a static area, and may be overwritten
	by subsequent calls to getpwent(3), getpwnam(), or getpwuid().

-- 
Dmitry Kozlyuk

  parent reply	other threads:[~2020-04-26 12:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26  3:22 [dpdk-dev] [PATCH 0/2] eal/windows: fix build by supporing trace Dmitry Kozlyuk
2020-04-26  3:22 ` [dpdk-dev] [PATCH 1/2] eal/windows: replace sys/queue.h with a complete one from FreeBSD Dmitry Kozlyuk
2020-04-26 11:14   ` Jerin Jacob
2020-04-26  3:22 ` [dpdk-dev] [PATCH 2/2] eal/windows: fix build by supporting trace Dmitry Kozlyuk
2020-04-26 11:32   ` Jerin Jacob
2020-04-26 12:02     ` Dmitry Kozlyuk
2020-04-26 12:23       ` Jerin Jacob
2020-04-26 12:36         ` Thomas Monjalon
2020-04-26 12:50         ` Dmitry Kozlyuk [this message]
2020-04-26 15:28 ` [dpdk-dev] [PATCH v2 0/3] eal/windows: fix build by enabling trace compilation Dmitry Kozlyuk
2020-04-26 15:28   ` [dpdk-dev] [PATCH v2 1/3] eal/windows: replace sys/queue.h with a complete one from FreeBSD Dmitry Kozlyuk
2020-04-26 15:28   ` [dpdk-dev] [PATCH v2 2/3] eal: add internal directory management API Dmitry Kozlyuk
2020-05-04 20:14     ` Narcisa Ana Maria Vasile
2020-04-26 15:28   ` [dpdk-dev] [PATCH v2 3/3] eal/windows: fix build by enabling trace compilation Dmitry Kozlyuk
2020-04-26 15:38     ` Thomas Monjalon
2020-04-26 16:42       ` Dmitry Kozlyuk
2020-04-26 16:41   ` [dpdk-dev] [PATCH v3] eal: disable tracing on Windows Dmitry Kozlyuk
2020-04-26 17:46     ` Jerin Jacob
2020-04-26 18:10       ` Thomas Monjalon

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=20200426155054.6a757920@Sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=Narcisa.Vasile@microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=harini.ramakrishnan@microsoft.com \
    --cc=jerinj@marvell.com \
    --cc=jerinjacobk@gmail.com \
    --cc=ocardona@microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=skori@marvell.com \
    --cc=thomas@monjalon.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).