summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorRoman Bolshakov2018-12-17 21:26:01 +0100
committerPeter Maydell2019-01-08 13:34:46 +0100
commit479a57475ec93390e647ed760c38b2120fef5f58 (patch)
tree1b3a0d8258f113ae8cf97ef78f5ba6dec034c2c4 /configure
parentui/cocoa: Include less of the generated modular QAPI headers (diff)
downloadqemu-479a57475ec93390e647ed760c38b2120fef5f58.tar.gz
qemu-479a57475ec93390e647ed760c38b2120fef5f58.tar.xz
qemu-479a57475ec93390e647ed760c38b2120fef5f58.zip
util: Implement debug-threads for macOS
macOS provides pthread_setname_np that doesn't have thread id argument. Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure32
1 files changed, 26 insertions, 6 deletions
diff --git a/configure b/configure
index 79375affc1..b9f34afc9e 100755
--- a/configure
+++ b/configure
@@ -3721,8 +3721,8 @@ if test "$mingw32" != yes -a "$pthread" = no; then
"Make sure to have the pthread libs and headers installed."
fi
-# check for pthread_setname_np
-pthread_setname_np=no
+# check for pthread_setname_np with thread id
+pthread_setname_np_w_tid=no
cat > $TMPC << EOF
#include <pthread.h>
@@ -3736,7 +3736,24 @@ int main(void)
}
EOF
if compile_prog "" "$pthread_lib" ; then
- pthread_setname_np=yes
+ pthread_setname_np_w_tid=yes
+fi
+
+# check for pthread_setname_np without thread id
+pthread_setname_np_wo_tid=no
+cat > $TMPC << EOF
+#include <pthread.h>
+
+static void *f(void *p) { pthread_setname_np("QEMU"); }
+int main(void)
+{
+ pthread_t thread;
+ pthread_create(&thread, 0, f, 0);
+ return 0;
+}
+EOF
+if compile_prog "" "$pthread_lib" ; then
+ pthread_setname_np_wo_tid=yes
fi
##########################################
@@ -6889,11 +6906,14 @@ fi
# Hold two types of flag:
# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
# a thread we have a handle to
-# CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
+# CONFIG_PTHREAD_SETNAME_NP_W_TID - A way of doing it on a particular
# platform
-if test "$pthread_setname_np" = "yes" ; then
+if test "$pthread_setname_np_w_tid" = "yes" ; then
+ echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
+ echo "CONFIG_PTHREAD_SETNAME_NP_W_TID=y" >> $config_host_mak
+elif test "$pthread_setname_np_wo_tid" = "yes" ; then
echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
- echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
+ echo "CONFIG_PTHREAD_SETNAME_NP_WO_TID=y" >> $config_host_mak
fi
if test "$vxhs" = "yes" ; then