X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Fcommon%2Finclude%2Frte_lcore.h;h=ac15130201c47c7092393fa965b59e9141faa4f6;hb=6a34f91690d0;hp=e1bd974c6848f60dd8111f0dba10429bd7d87781;hpb=3e10f2368a902e32685e116dcda7ce074829cd5c;p=dpdk.git diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index e1bd974c68..ac15130201 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -81,13 +81,12 @@ struct lcore_config { extern struct lcore_config lcore_config[RTE_MAX_LCORE]; RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */ -RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id". */ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ /** * Return the ID of the execution unit we are running on. * @return - * Logical core ID(in EAL thread) or LCORE_ID_ANY(in non-EAL thread) + * Logical core ID (in EAL thread) or LCORE_ID_ANY (in non-EAL thread) */ static inline unsigned rte_lcore_id(void) @@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id) * @return * the ID of current lcoreid's physical socket */ -static inline unsigned -rte_socket_id(void) -{ - return RTE_PER_LCORE(_socket_id); -} +unsigned rte_socket_id(void); /** * Get the ID of the physical socket of the specified lcore @@ -180,7 +175,7 @@ rte_lcore_is_enabled(unsigned lcore_id) struct rte_config *cfg = rte_eal_get_configuration(); if (lcore_id >= RTE_MAX_LCORE) return 0; - return (cfg->lcore_role[lcore_id] != ROLE_OFF); + return cfg->lcore_role[lcore_id] != ROLE_OFF; } /** @@ -252,6 +247,26 @@ int rte_thread_set_affinity(rte_cpuset_t *cpusetp); */ void rte_thread_get_affinity(rte_cpuset_t *cpusetp); +/** + * Set thread names. + * + * Macro to wrap `pthread_setname_np()` with a glibc version check. + * Only glibc >= 2.12 supports this feature. + * + * This macro only used for Linux, BSD does direct libc call. + * BSD libc version of function is `pthread_set_name_np()`. + */ +#if defined(__DOXYGEN__) +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__) +#endif + +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 12) +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__) +#else +#define rte_thread_setname(...) 0 +#endif +#endif #ifdef __cplusplus }