hashtable: silence -fsanitize=address warning for `hashlittle()` function
[lttng-tools.git] / src / common / error.c
index 82190b9fd527cea831f61e9620b43f73d1984c17..7ededdb734251e73e0a63a5dbf5705237cf9041e 100644 (file)
@@ -7,13 +7,14 @@
 
 #define _LGPL_SOURCE
 #include <assert.h>
-#include <errno.h>
 #include <inttypes.h>
 #include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include <common/common.h>
+#include <common/thread.h>
+#include <common/compat/errno.h>
 #include <common/compat/getenv.h>
 #include <lttng/lttng-error.h>
 
@@ -77,16 +78,9 @@ void logger_set_thread_name(const char *name, bool set_pthread_name)
        URCU_TLS(logger_thread_name) = name;
 
        if (set_pthread_name) {
-               char pthread_name[16];
-
-               /*
-                * Truncations are expected since pthread limits thread names to
-                * a generous 16 characters.
-                */
-               strncpy(pthread_name, name, sizeof(pthread_name));
-               pthread_name[sizeof(pthread_name) - 1] = '\0';
-               ret = pthread_setname_np(pthread_self(), pthread_name);
-               if (ret) {
+               ret = lttng_thread_setname(name);
+               if (ret && ret != -ENOSYS) {
+                       /* Don't fail as this is not essential. */
                        DBG("Failed to set pthread name attribute");
                }
        }
This page took 0.023416 seconds and 4 git commands to generate.