X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ferror.c;h=7ededdb734251e73e0a63a5dbf5705237cf9041e;hp=82190b9fd527cea831f61e9620b43f73d1984c17;hb=1405051ad116a8bd42b68822be6d2f9b3def6c65;hpb=f5fb86c1254b785eee8caf87cb996d33eda0ede9 diff --git a/src/common/error.c b/src/common/error.c index 82190b9fd..7ededdb73 100644 --- a/src/common/error.c +++ b/src/common/error.c @@ -7,13 +7,14 @@ #define _LGPL_SOURCE #include -#include #include #include #include #include #include +#include +#include #include #include @@ -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"); } }