/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2010-2014 Intel Corporation */ #include #include #include #include #include #include #include #include /* require calling thread tid by gettid() */ int rte_sys_gettid(void) { return (int)syscall(SYS_gettid); } int rte_thread_setname(pthread_t id, const char *name) { int ret = ENOSYS; #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2, 12) char truncated[16]; strlcpy(truncated, name, sizeof(truncated)); ret = pthread_setname_np(id, truncated); #endif #endif RTE_SET_USED(id); RTE_SET_USED(name); return -ret; } int rte_thread_getname(pthread_t id, char *name, size_t len) { int ret = ENOSYS; #if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2, 12) ret = pthread_getname_np(id, name, len); #endif #endif RTE_SET_USED(id); RTE_SET_USED(name); RTE_SET_USED(len); return -ret; }