util: Include pthread_np.h on FreeBSD
[sliver-openvswitch.git] / lib / util.c
index 1751c6f..3cada4a 100644 (file)
@@ -30,6 +30,9 @@
 #include "coverage.h"
 #include "ovs-thread.h"
 #include "vlog.h"
+#ifdef HAVE_PTHREAD_SET_NAME_NP
+#include <pthread_np.h>
+#endif
 
 VLOG_DEFINE_THIS_MODULE(util);
 
@@ -46,7 +49,9 @@ DEFINE_PER_THREAD_MALLOCED_DATA(char *, subprogram_name);
 static char *program_version;
 
 /* Buffer used by ovs_strerror(). */
-DEFINE_PER_THREAD_DATA(struct { char s[128]; }, strerror_buffer, { "" });
+DEFINE_STATIC_PER_THREAD_DATA(struct { char s[128]; },
+                              strerror_buffer,
+                              { "" });
 
 void
 ovs_assert_failure(const char *where, const char *function,