QEMU: add support for setting threads name on OpenBSD, from Brad
This commit is contained in:
parent
54bbdfd8f3
commit
70ffa9b266
@ -6,6 +6,7 @@ COMMENT-ga= QEMU guest agent
|
||||
|
||||
VERSION= 7.2.0
|
||||
DISTNAME= qemu-${VERSION}
|
||||
REVISION= 0
|
||||
CATEGORIES= emulators
|
||||
MASTER_SITES= https://download.qemu.org/
|
||||
EXTRACT_SUFX= .tar.xz
|
||||
|
@ -1,5 +1,6 @@
|
||||
- localstatedir does not belong under prefix
|
||||
- Remove hardcoding of optimization
|
||||
- thread-posix: add support for setting threads name on OpenBSD
|
||||
|
||||
Index: meson.build
|
||||
--- meson.build.orig
|
||||
@ -22,7 +23,26 @@ Index: meson.build
|
||||
config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
|
||||
config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
|
||||
|
||||
@@ -3756,11 +3756,9 @@ if targetos == 'darwin'
|
||||
@@ -2123,6 +2123,18 @@ config_host_data.set('CONFIG_PTHREAD_SETNAME_NP_WO_TID
|
||||
pthread_create(&thread, 0, f, 0);
|
||||
return 0;
|
||||
}''', dependencies: threads))
|
||||
+config_host_data.set('CONFIG_PTHREAD_SET_NAME_NP', cc.links(gnu_source_prefix + '''
|
||||
+ #include <pthread.h>
|
||||
+ #include <pthread_np.h>
|
||||
+
|
||||
+ static void *f(void *p) { return NULL; }
|
||||
+ int main(void)
|
||||
+ {
|
||||
+ pthread_t thread;
|
||||
+ pthread_create(&thread, 0, f, 0);
|
||||
+ pthread_set_name_np(thread, "QEMU");
|
||||
+ return 0;
|
||||
+ }''', dependencies: threads))
|
||||
config_host_data.set('CONFIG_PTHREAD_CONDATTR_SETCLOCK', cc.links(gnu_source_prefix + '''
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
@@ -3756,11 +3768,9 @@ if targetos == 'darwin'
|
||||
summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())}
|
||||
endif
|
||||
summary_info += {'CFLAGS': ' '.join(get_option('c_args')
|
||||
|
35
emulators/qemu/patches/patch-util_qemu-thread-posix_c
Normal file
35
emulators/qemu/patches/patch-util_qemu-thread-posix_c
Normal file
@ -0,0 +1,35 @@
|
||||
thread-posix: add support for setting threads name on OpenBSD
|
||||
|
||||
Index: util/qemu-thread-posix.c
|
||||
--- util/qemu-thread-posix.c.orig
|
||||
+++ util/qemu-thread-posix.c
|
||||
@@ -18,6 +18,10 @@
|
||||
#include "qemu/tsan.h"
|
||||
#include "qemu/bitmap.h"
|
||||
|
||||
+#ifdef CONFIG_PTHREAD_SET_NAME_NP
|
||||
+#include <pthread_np.h>
|
||||
+#endif
|
||||
+
|
||||
static bool name_threads;
|
||||
|
||||
void qemu_thread_naming(bool enable)
|
||||
@@ -25,7 +29,8 @@ void qemu_thread_naming(bool enable)
|
||||
name_threads = enable;
|
||||
|
||||
#if !defined CONFIG_PTHREAD_SETNAME_NP_W_TID && \
|
||||
- !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID
|
||||
+ !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID && \
|
||||
+ !defined CONFIG_PTHREAD_SET_NAME_NP
|
||||
/* This is a debugging option, not fatal */
|
||||
if (enable) {
|
||||
fprintf(stderr, "qemu: thread naming not supported on this host\n");
|
||||
@@ -480,6 +485,8 @@ static void *qemu_thread_start(void *args)
|
||||
pthread_setname_np(pthread_self(), qemu_thread_args->name);
|
||||
# elif defined(CONFIG_PTHREAD_SETNAME_NP_WO_TID)
|
||||
pthread_setname_np(qemu_thread_args->name);
|
||||
+# elif defined(CONFIG_PTHREAD_SET_NAME_NP)
|
||||
+ pthread_set_name_np(pthread_self(), qemu_thread_args->name);
|
||||
# endif
|
||||
}
|
||||
QEMU_TSAN_ANNOTATE_THREAD_NAME(qemu_thread_args->name);
|
Loading…
x
Reference in New Issue
Block a user