[dpdk-dev] [PATCH] eal/linux: truncate thread name
David Marchand
david.marchand at redhat.com
Fri Jul 10 14:44:24 CEST 2020
On Fri, Jul 10, 2020 at 2:41 PM Thomas Monjalon <thomas at monjalon.net> wrote:
>
> 10/07/2020 11:45, David Marchand:
> > pthread_setname_np refuses names larger than 16 bytes (\0 included).
> > Rather than return an error, truncate the name to this limit in the
> > rte_thread_setname helper.
> [...]
> > --- a/lib/librte_eal/linux/eal_thread.c
> > +++ b/lib/librte_eal/linux/eal_thread.c
> > @@ -153,7 +153,10 @@ int rte_thread_setname(pthread_t id, const char *name)
> > int ret = ENOSYS;
> > #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
> > #if __GLIBC_PREREQ(2, 12)
> > - ret = pthread_setname_np(id, name);
> > + char truncated[16];
>
> That's a pity POSIX is not defining a constant for this limit.
pthread_setname "_np" :-)
--
David Marchand
More information about the dev
mailing list