examples/performance-thread: fix build on FreeBSD
authorBruce Richardson <bruce.richardson@intel.com>
Fri, 21 Apr 2017 13:50:23 +0000 (14:50 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 21 Apr 2017 14:20:16 +0000 (16:20 +0200)
This set of sample apps did not compile on FreeBSD due to use of a number
of Linux/glibc-specific APIs, or APIs which existed in different headers
on FreeBSD. Specifically, the following APIs has problems:
  * sched_getcpu() is a glibc extension, so use rte_lcore_id() on BSD
  * pthread_yield() returns int on Linux, but void on FreeBSD, so
    we have to create two slightly different copies of the function.
  * the type for managing cpu sets is cpuset_t on FreeBSD rather than
    cpu_set_t as on Linux, so use rte_cpuset_t from rte_lcore.h.
  * APIs for managing cpu affinity are in pthread_np.h on FreeBSD, rather
    than in pthread.h, also fixed by including rte_lcore.h

Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim app")
Fixes: d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

No differences found