DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Thomas Monjalon <thomas@monjalon.net>, <dev@dpdk.org>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: Re: [RFC 01/47] eal: add BSD version of queue.h
Date: Tue, 19 Aug 2025 17:07:28 +0100	[thread overview]
Message-ID: <aKShQNPf9lmRtOnf@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20250819090341.0ce15d26@hermes.local>

On Tue, Aug 19, 2025 at 09:03:41AM -0700, Stephen Hemminger wrote:
> On Tue, 19 Aug 2025 16:40:28 +0100
> Bruce Richardson <bruce.richardson@intel.com> wrote:
> 
> > On Tue, Aug 19, 2025 at 05:29:28PM +0200, Thomas Monjalon wrote:
> > > 19/08/2025 17:24, Stephen Hemminger:  
> > > > On Tue, 19 Aug 2025 10:37:27 +0200
> > > > Thomas Monjalon <thomas@monjalon.net> wrote:
> > > >   
> > > > > 19/08/2025 01:27, Stephen Hemminger:  
> > > > > > +++ b/lib/eal/include/bsd_queue.h
> > > > > > @@ -0,0 +1,1075 @@
> > > > > > +/*-
> > > > > > + * SPDX-License-Identifier: BSD-3-Clause
> > > > > > + *
> > > > > > + * Copyright (c) 1991, 1993
> > > > > > + *     The Regents of the University of California.  All rights reserved.
> > > > > > + *
> > > > > > + * This is a copy of sys/queue.h which is used to overcome
> > > > > > + * missing parts in the glibc version (and Windows).
> > > > > > + */
> > > > > > +
> > > > > > +#ifndef _SYS_QUEUE_H_
> > > > > > +#define _SYS_QUEUE_H_    
> > > > > 
> > > > > Shouldn't we rename this include flag? with RTE_ prefix?  
> > > > 
> > > > 
> > > > No, by keeping the same prefix if the user includes both sys/queue.h and bsd_queue.h
> > > > there will be no confilcts.  
> > > 
> > > You mean by checking _SYS_QUEUE_H_ which is the same as sys/queue.h?
> > > So if I include sys/queue.h first, I will have a limited version.
> > > It means we should not include it before any DPDK include.
> > > It looks like a limitation for DPDK users.
> > >   
> > I think we should define two defines for our header, and warn if
> > sys/queue.h is included first.
> > 
> > #ifndef _RTE_BSD_QUEUE_H_
> > #ifdef _SYS_QUEUE_H_
> > #warning ...
> > #endif
> > 
> > #define _RTE_BSD_QUEUE_H_
> > #define _SYS_QUEUE_H_
> > 
> > ...
> > 
> > #endif
> > 
> > This way, sys/queue.h contents will be skipped after our header, but if
> > it's included first, the user gets a warning about incomplete
> > implementation.
> > 
> > /Bruce
> 
> There is a similar issue with kernel headers already. And it lead
> to lots if #ifdef __UAPI_DEF_XXX which I want to avoid.
> 
> Rather just do wholesale replacement and if application includes
> the other header, it will work since the BSD stuff is only used
> as add on.
> 
That level of ifdef checks what my suggestions above is trying to avoid.
Just by having our own header define, as well as defining the standing
sys/queue.h one, we can avoid having queue.h included after us, and also
warn the user if they have already included the incomplete header. [Though
for correctness, I suppose the first endif above should be an #else, so
avoid dup definitions if that occurs]

/Bruce

  reply	other threads:[~2025-08-19 16:07 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18 23:27 [RFC 00/47] resolve issues with sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 01/47] eal: add BSD version of queue.h Stephen Hemminger
2025-08-19  8:00   ` Bruce Richardson
2025-08-19  8:37   ` Thomas Monjalon
2025-08-19 15:24     ` Stephen Hemminger
2025-08-19 15:29       ` Thomas Monjalon
2025-08-19 15:40         ` Bruce Richardson
2025-08-19 16:03           ` Stephen Hemminger
2025-08-19 16:07             ` Bruce Richardson [this message]
2025-08-19 17:46               ` Stephen Hemminger
2025-08-19 17:44         ` Stephen Hemminger
2025-08-18 23:27 ` [RFC 02/47] net/nfp: fix use after free Stephen Hemminger
2025-08-18 23:27 ` [RFC 03/47] eal: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 04/47] test: remove unnecessary inclusion of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 05/47] testpmd: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 06/47] dumpcap: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 07/47] proc-info: remove unnecessary sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 08/47] doc: suggest bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 09/47] test-pipeline: remove unnecessary use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 10/47] test-eventdev: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 11/47] test-bbdev, test-cmdline, test-mldev: don't use sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 12/47] examples: replace use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 13/47] hash: do not include sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 14/47] lpm: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 15/47] log: replace use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 16/47] ethdev: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 17/47] bpf: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 18/47] mempool: do not need sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 19/47] lib: remove use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 20/47] bus/fslmc: use rte_tailq.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 21/47] drivers/bus: replace use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 22/47] net/qede: use bsd_queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 23/47] net/bnxt: remove use of sys/queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 24/47] net/intel: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 25/47] net/mlx5: remove unnecessary include " Stephen Hemminger
2025-08-18 23:27 ` [RFC 26/47] net/tap: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 27/47] net/axgbe: replace use " Stephen Hemminger
2025-08-18 23:27 ` [RFC 28/47] net/bnx2x: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 29/47] net/bonding: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 30/47] net/cxgbe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 31/47] net/enic: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 32/47] net/failsafe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 33/47] net/memif: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 34/47] net/mlx4: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 35/47] net/ngbe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 36/47] net/ntnic: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 37/47] net/sfc: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 38/47] net/softnic: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 39/47] net/thunderx: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 40/47] net/txgbe: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 41/47] net/vdev_netvsc: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 42/47] net/vmxnet3: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 43/47] net/zxdh: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 44/47] net/dpaa2: " Stephen Hemminger
2025-08-18 23:27 ` [RFC 45/47] eal: remove no longer used windows version of queue.h Stephen Hemminger
2025-08-18 23:27 ` [RFC 46/47] net/mvpp2: replace local definition of FOREACH_SAFE Stephen Hemminger
2025-08-18 23:27 ` [RFC 47/47] drivers/raw: replace with TAILQ_FOREACH_SAFE Stephen Hemminger
2025-08-19  8:01 ` [RFC 00/47] resolve issues with sys/queue.h Bruce Richardson

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=aKShQNPf9lmRtOnf@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=roretzla@linux.microsoft.com \
    --cc=stephen@networkplumber.org \
    --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).