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.richard...@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 <tho...@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