summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2018-05-09 07:06:38 -0400
committerKaleb KEITHLEY <kkeithle@redhat.com>2018-05-10 12:47:53 +0000
commitbfff9e4d50ebf3f4b51eae6c3c1d5df2dc43fe0f (patch)
tree330df2a2859a8b08acf8bd573f81ac54069e98ee
parent07d8cc04c451f25961eaf5a8ad9ae767800eb2db (diff)
core: FreeBSD has pthread_set_name_np() (versus pthread_setname_np())release-4.0
And has had it since at least FreeBSD 9.0 Reported-by: Roman Serbski <mefystofel@gmail.com> Change-Id: I52cfde7f2f7a82d0e66465ac392ed7e201e1653b BUG: 1576815 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
-rw-r--r--libglusterfs/src/common-utils.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 9ad9355..1d0dba4 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -53,6 +53,10 @@
#include <ifaddrs.h>
#include "libglusterfs-messages.h"
#include "protocol-common.h"
+#ifdef __FreeBSD__
+#include <pthread_np.h>
+#undef BIT_SET
+#endif
#ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0
@@ -3758,11 +3762,13 @@ gf_thread_create (pthread_t *thread, const pthread_attr_t *attr,
pthread_setname_np(*thread, thread_name);
#elif defined(__NetBSD__)
pthread_setname_np(*thread, thread_name, NULL);
+ #elif defined(__FreeBSD__)
+ pthread_set_name_np(*thread, thread_name);
#else
gf_msg (THIS->name, GF_LOG_WARNING, 0,
LG_MSG_PTHREAD_NAMING_FAILED,
- "Thread names not implemented on this "
- "platform");
+ "Could not set thread name: %s",
+ thread_name);
#endif
}