MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_thread_set_name

Function rte_thread_set_name

dpdk/lib/eal/linux/eal_thread.c:22–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name)
23{
24 int ret = ENOSYS;
25#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
26#if __GLIBC_PREREQ(2, 12)
27 char truncated[RTE_THREAD_NAME_SIZE];
28 const size_t truncatedsz = sizeof(truncated);
29
30 if (strlcpy(truncated, thread_name, truncatedsz) >= truncatedsz)
31 RTE_LOG(DEBUG, EAL, "Truncated thread name\n");
32
33 ret = pthread_setname_np((pthread_t)thread_id.opaque_id, truncated);
34#endif
35#endif
36 RTE_SET_USED(thread_id);
37 RTE_SET_USED(thread_name);
38
39 if (ret != 0)
40 RTE_LOG(DEBUG, EAL, "Failed to set thread name\n");
41}

Callers 3

rte_eal_initFunction · 0.70

Calls 1

strlcpyFunction · 0.50

Tested by

no test coverage detected