[dpdk-dev] [PATCH v2] eal: fix compile error for old glibc caused by pthread_setname_np()

Thomas Monjalon thomas.monjalon at 6wind.com
Wed Nov 25 12:30:47 CET 2015


2015-11-25 11:24, Ferruh Yigit:
> On Wed, Nov 25, 2015 at 12:18:02PM +0100, Thomas Monjalon wrote:
> > 2015-11-25 11:13, Ferruh Yigit:
> > > +/**
> > > + * Set thread names.
> > > + *
> > > + * Macro to wrap `pthread_setname_np()` with a glibc version check.
> > > + * Only glibc >= 2.12 supports this feature.
> > > + *
> > > + * This macro only used for Linux, BSD does direct libc call.
> > > + * BSD libc version of function is `pthread_set_name_np()`.
> > > + */
> > > +#if defined(__DOXYGEN__)
> > > +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
> > > +#endif
> > > +
> > > +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
> > > +#if __GLIBC_PREREQ(2, 12)
> > > +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
> > > +#else
> > > +#define rte_thread_setname(...) 0
> > > +#endif
> > > +#endif
> > 
> > OK it is a first (and important) fix.
> > EAL is an abstraction for Linux and FreeBSD, so ideally another patch would
> > make rte_thread_setname working for BSD too.
> 
> I wasn't sure to do that update, since BSD has nothing with glibc versions.
> Do you want me amend this patch to update BSD usage to rte_thread_setname?

No, for 2.2, you have fixed the glibc issue, that's enough.
BSD support can be another path as it is not a real issue currently.



More information about the dev mailing list