extern "C" {
#endif
-#define LCORE_ID_ANY -1 /**< Any lcore. */
+#define LCORE_ID_ANY UINT32_MAX /**< Any lcore. */
#if defined(__linux__)
typedef cpu_set_t rte_cpuset_t;
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
+ * Logical core ID (in EAL thread) or LCORE_ID_ANY (in non-EAL thread)
*/
static inline unsigned
rte_lcore_id(void)
* @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
*/
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
}