util: fix use of pthread_get_name_np on OpenBSD

The pthread_get_name_np function is present on FreeBSD and OpenBSD
and has 'void' return not 'int'. We didn't notice this build problem
on FreeBSD since it also has pthread_getname_np which does return
int like Linux and we use the latter preferentially.

Fixes: 215235d365
Closes: https://gitlab.com/qemu-project/qemu/-/work_items/3399
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260417120531.2215549-1-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2026-04-17 13:05:31 +01:00
committed by Thomas Huth
parent 7dfea705cb
commit b8c2426157

View File

@@ -568,7 +568,8 @@ const char *qemu_thread_get_name(void)
# if defined(CONFIG_PTHREAD_GETNAME_NP)
rv = pthread_getname_np(pthread_self(), namebuf, sizeof(namebuf));
# elif defined(CONFIG_PTHREAD_GET_NAME_NP)
rv = pthread_get_name_np(pthread_self(), namebuf, sizeof(namebuf));
pthread_get_name_np(pthread_self(), namebuf, sizeof(namebuf));
rv = 0;
# else
rv = -1;
# endif