On 1/9/26 12:56, Daniel P. Berrangé wrote:
On Fri, Jan 09, 2026 at 12:49:20PM +0100, Paolo Bonzini wrote:
On 1/8/26 18:03, Daniel P. Berrangé wrote:
+static __thread char namebuf[PTHREAD_MAX_NAMELEN_NP];
... you can instead of the previous patch, add a constructor here that just
sets namebuf to "main" with strcpy.
How about just a static initializer
static __thread char namebuf[PTHREAD_MAX_NAMELEN_NP] = { 'm', 'a', 'i', 'n',
'\0' };
or is there some interaction with __thread that makes that undesirable ?
This would break here:
if (namebuf[0] != '\0') {
return namebuf;
}
and every thread would have "main" as the name, because static
initializers for __thread apply to all threads.
Thanks,
Paolo