From 6d9e878cfb5329856b3d5265a919ae6404297858 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 11 Apr 2018 09:52:23 -0400
Subject: [PATCH 3/3] SLES11: Hackily avoid pthread_set_name_np on linux

---
 src/thread.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/thread.cpp b/src/thread.cpp
index 84473dca..40db8e38 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -32,6 +32,10 @@
 #include "thread.hpp"
 #include "err.hpp"
 
+#if defined(__linux__)
+#include <sys/prctl.h>
+#endif
+
 bool zmq::thread_t::get_started () const
 {
     return _started;
@@ -309,6 +313,11 @@ void zmq::thread_t::setThreadName (const char *name_)
     if (!name_)
         return;
 
+/* Conda SLES11 support hack. Never to be upstreamed */
+#if defined(__linux__)
+    prctl (PR_SET_NAME, name_, 0, 0, 0, 0);
+    return;
+#else
 #if defined(ZMQ_HAVE_PTHREAD_SETNAME_1)
     int rc = pthread_setname_np (name_);
     if (rc)
@@ -324,6 +333,7 @@ void zmq::thread_t::setThreadName (const char *name_)
 #elif defined(ZMQ_HAVE_PTHREAD_SET_NAME)
     pthread_set_name_np (_descriptor, name_);
 #endif
+#endif
 }
 
 #endif
-- 
2.17.2 (Apple Git-113)

