summaryrefslogtreecommitdiff
path: root/emulators/qemu/patches/patch-util_qemu-thread-posix_c
diff options
context:
space:
mode:
Diffstat (limited to 'emulators/qemu/patches/patch-util_qemu-thread-posix_c')
-rw-r--r--emulators/qemu/patches/patch-util_qemu-thread-posix_c35
1 files changed, 35 insertions, 0 deletions
diff --git a/emulators/qemu/patches/patch-util_qemu-thread-posix_c b/emulators/qemu/patches/patch-util_qemu-thread-posix_c
new file mode 100644
index 0000000..112abb5
--- /dev/null
+++ b/emulators/qemu/patches/patch-util_qemu-thread-posix_c
@@ -0,0 +1,35 @@
1thread-posix: add support for setting threads name on OpenBSD
2
3Index: util/qemu-thread-posix.c
4--- util/qemu-thread-posix.c.orig
5+++ util/qemu-thread-posix.c
6@@ -18,6 +18,10 @@
7 #include "qemu/tsan.h"
8 #include "qemu/bitmap.h"
9
10+#ifdef CONFIG_PTHREAD_SET_NAME_NP
11+#include <pthread_np.h>
12+#endif
13+
14 static bool name_threads;
15
16 void qemu_thread_naming(bool enable)
17@@ -25,7 +29,8 @@ void qemu_thread_naming(bool enable)
18 name_threads = enable;
19
20 #if !defined CONFIG_PTHREAD_SETNAME_NP_W_TID && \
21- !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID
22+ !defined CONFIG_PTHREAD_SETNAME_NP_WO_TID && \
23+ !defined CONFIG_PTHREAD_SET_NAME_NP
24 /* This is a debugging option, not fatal */
25 if (enable) {
26 fprintf(stderr, "qemu: thread naming not supported on this host\n");
27@@ -480,6 +485,8 @@ static void *qemu_thread_start(void *args)
28 pthread_setname_np(pthread_self(), qemu_thread_args->name);
29 # elif defined(CONFIG_PTHREAD_SETNAME_NP_WO_TID)
30 pthread_setname_np(qemu_thread_args->name);
31+# elif defined(CONFIG_PTHREAD_SET_NAME_NP)
32+ pthread_set_name_np(pthread_self(), qemu_thread_args->name);
33 # endif
34 }
35 QEMU_TSAN_ANNOTATE_THREAD_NAME(qemu_thread_args->name);