util: fix cpuset support on FreeBSD
authorGreg V <greg@unrelenting.technology>
Sun, 16 Sep 2018 16:51:51 +0000 (19:51 +0300)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 8 Aug 2019 20:44:33 +0000 (21:44 +0100)
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
meson.build
src/util/u_thread.h

index 06953b364a8fbb5c75216c2a4cd9ed2d9f2257ef..5605b92b05d0623109dacfd7b0fb4dbc7b352c8d 100644 (file)
@@ -1143,6 +1143,12 @@ if dep_thread.found() and host_machine.system() != 'windows'
       args : '-D_GNU_SOURCE')
     pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
   endif
+  if cc.has_function(
+      'pthread_setaffinity_np',
+      dependencies : dep_thread,
+      prefix : '#include <pthread_np.h>')
+    pre_args += '-DPTHREAD_SETAFFINITY_IN_NP_HEADER'
+  endif
 endif
 dep_expat = dependency('expat')
 # this only exists on linux so either this is linux and it will be found, or
index 1648d2f58418478e669f0b0369f63fa3131f61e8..c6b35d0814ba08cd172cddea7fb1d677d9c1f17f 100644 (file)
 
 #ifdef HAVE_PTHREAD
 #include <signal.h>
+#ifdef PTHREAD_SETAFFINITY_IN_NP_HEADER
+#include <pthread_np.h>
+#endif
+#endif
+
+#ifdef __FreeBSD__
+#define cpu_set_t cpuset_t
 #endif
 
 static inline thrd_t u_thread_create(int (*routine)(void *), void *param)