eal/linux: truncate thread name
authorDavid Marchand <david.marchand@redhat.com>
Fri, 10 Jul 2020 09:45:50 +0000 (11:45 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Sat, 11 Jul 2020 13:03:47 +0000 (15:03 +0200)
commit7d1af09e9857c7854bea1d7cae38feb212a8defd
tree5fd68ed13b80432ea19e3e60da2afe2e2d6ffb80
parent0f392d91b9977fdb879ef595839806c29b150c14
eal/linux: truncate thread name

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.

Caught with ixgbe which creates control thread with name
"ixgbe-link-handler":

Configuring Port 0 (socket 0)
EAL: Cannot set name for ctrl thread
...
EAL: Cannot set name for ctrl thread

Port 0: link state change event
...
EAL: Cannot set name for ctrl thread

Port 0: link state change event

Note: before this change, the thread would keep its original name, which
meant in my test for the ixgbe handler either "dpdk-testpmd" or
"eal-intr-thread".

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
lib/librte_eal/linux/eal_thread.c