util: fix use of pthread_get_name_np on OpenBSD
PATCH 1/1 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.
---
This is a regression in the 11.0 release, but on the assumption it is too late for further fixes, I'm CC'ing qemu-stable so this can go into the future stable-11.0 branch
util/qemu-thread-posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
util/qemu-thread-posix.c +2 -1
@@ -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
Signature · 1 line
2.53.0
Quoted 22 lines · Daniel P. Berrangé
The
pthread_get_name_npfunction is present on FreeBSD and OpenBSD and has 'void' return not 'int'. We didn't notice this build problem on FreeBSD since it also haspthread_getname_npwhich does return int like Linux and we use the latter preferentially.Fixes 215235d365e49c72a85ea2940751e45419676031Signed-off-by Daniel P. Berrangé <[email protected]>---
This is a regression in the 11.0 release, but on the assumption it is too late for further fixes, I'm CC'ing qemu-stable so this can go into the future stable-11.0 branch
util/qemu-thread-posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)util/qemu-thread-posix.c +0
-0
util/qemu-thread-posix.c const char *qemu_thread_get_name(void) · line 575
Quoted 9 lines
util/qemu-thread-posix.c +2
-1@@ -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
Quoted 22 lines · Daniel P. Berrangé
The
pthread_get_name_npfunction is present on FreeBSD and OpenBSD and has 'void' return not 'int'. We didn't notice this build problem on FreeBSD since it also haspthread_getname_npwhich does return int like Linux and we use the latter preferentially.Fixes 215235d365e49c72a85ea2940751e45419676031Signed-off-by Daniel P. Berrangé <[email protected]>---
This is a regression in the 11.0 release, but on the assumption it is too late for further fixes, I'm CC'ing qemu-stable so this can go into the future stable-11.0 branch
util/qemu-thread-posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)util/qemu-thread-posix.c +0
-0
util/qemu-thread-posix.c const char *qemu_thread_get_name(void) · line 575
Quoted 9 lines
util/qemu-thread-posix.c +2
-1@@ -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