xref: /dpdk/lib/eal/freebsd/eal_thread.c (revision 97b914f4e715565d53d38ac6e04815b9be5e58a9)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
5 #include <errno.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <stdint.h>
9 #include <unistd.h>
10 #include <sched.h>
11 #include <pthread_np.h>
12 #include <sys/queue.h>
13 #include <sys/thr.h>
14 
15 #include <rte_debug.h>
16 #include <rte_atomic.h>
17 #include <rte_launch.h>
18 #include <rte_log.h>
19 #include <rte_memory.h>
20 #include <rte_per_lcore.h>
21 #include <rte_eal.h>
22 #include <rte_lcore.h>
23 
24 #include "eal_private.h"
25 #include "eal_thread.h"
26 
27 /* require calling thread tid by gettid() */
28 int rte_sys_gettid(void)
29 {
30 	long lwpid;
31 	thr_self(&lwpid);
32 	return (int)lwpid;
33 }
34 
35 int rte_thread_setname(pthread_t id, const char *name)
36 {
37 	/* this BSD function returns no error */
38 	pthread_set_name_np(id, name);
39 	return 0;
40 }
41 
42 int rte_thread_getname(pthread_t id, char *name, size_t len)
43 {
44 	RTE_SET_USED(id);
45 	RTE_SET_USED(name);
46 	RTE_SET_USED(len);
47 
48 	return -ENOTSUP;
49 }
50