2ff3976e67
These header includes have been flagged by the iwyu_tool and removed. Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
51 lines
1001 B
C
51 lines
1001 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright(c) 2010-2014 Intel Corporation
|
|
*/
|
|
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <pthread.h>
|
|
#include <sys/syscall.h>
|
|
|
|
#include <rte_eal.h>
|
|
#include <rte_lcore.h>
|
|
#include <rte_string_fns.h>
|
|
|
|
/* 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;
|
|
|
|
}
|