From 47ff7010a48e8cc6d8f5e2a5bb8deae157ca1512 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Fri, 7 Nov 2025 12:35:45 +0100 Subject: [PATCH] Update threadCreate - if the name is too long, the thread name is shortened to maximum pthread name (16 characters). --- common/utils/system.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/utils/system.c b/common/utils/system.c index 270c3ae321..e38d97768a 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -282,8 +282,13 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, ret=pthread_create(t, &attr, func, param); AssertFatal(ret == 0, "Error in pthread_create(): ret: %d, errno: %d\n", ret, errno); - - pthread_setname_np(*t, name); + + char short_name[16]; + strncpy(short_name, name, sizeof(short_name) - 1); + short_name[sizeof(short_name) - 1] = '\0'; + ret = pthread_setname_np(*t, short_name); + AssertFatal(ret == 0, "Error in pthread_setname_np(): ret: %d, errno: %d\n", ret, errno); + if (affinity != -1 ) { cpu_set_t cpuset; CPU_ZERO(&cpuset);