aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-03-28 13:46:28 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-03-28 13:46:29 +0000
commit3b6144bdbb42705c95e3ed0e8c7bbe277352c0b8 (patch)
tree0935c432e4e47e4f98f77453fb04a4816182559c /util
parent9c5793c5036c7608ff2c87846c6d11f904c08b58 (diff)
parentb89834f4d79070a26536cb73fe5216a2364551eb (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
acpi,pc,build bug fixes Here are some bugfixes for 2.0. A bugfix for acpi for pci bridges, and a build fix for old systems without pthread_setname_np: both fix regressions so we definitely want to include them. HPET fix is not for a regression but looks very safe, fixes a nasty bug and has been on list for a while. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Fri 28 Mar 2014 12:00:12 GMT using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: acpi: fix ACPI generation for pci bridges Don't enable a HPET timer if HPET is disabled Detect pthread_setname_np at configure time Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-thread-posix.c21
-rw-r--r--util/qemu-thread-win32.c2
2 files changed, 20 insertions, 3 deletions
diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c
index 960d7f5d42..d05a6497e1 100644
--- a/util/qemu-thread-posix.c
+++ b/util/qemu-thread-posix.c
@@ -32,6 +32,13 @@ static bool name_threads;
void qemu_thread_naming(bool enable)
{
name_threads = enable;
+
+#ifndef CONFIG_THREAD_SETNAME_BYTHREAD
+ /* This is a debugging option, not fatal */
+ if (enable) {
+ fprintf(stderr, "qemu: thread naming not supported on this host\n");
+ }
+#endif
}
static void error_exit(int err, const char *msg)
@@ -394,6 +401,16 @@ void qemu_event_wait(QemuEvent *ev)
}
}
+/* Attempt to set the threads name; note that this is for debug, so
+ * we're not going to fail if we can't set it.
+ */
+static void qemu_thread_set_name(QemuThread *thread, const char *name)
+{
+#ifdef CONFIG_PTHREAD_SETNAME_NP
+ pthread_setname_np(thread->thread, name);
+#endif
+}
+
void qemu_thread_create(QemuThread *thread, const char *name,
void *(*start_routine)(void*),
void *arg, int mode)
@@ -420,11 +437,9 @@ void qemu_thread_create(QemuThread *thread, const char *name,
if (err)
error_exit(err, __func__);
-#if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
if (name_threads) {
- pthread_setname_np(thread->thread, name);
+ qemu_thread_set_name(thread, name);
}
-#endif
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c
index b9c957b6a0..c405c9bef6 100644
--- a/util/qemu-thread-win32.c
+++ b/util/qemu-thread-win32.c
@@ -22,6 +22,8 @@ void qemu_thread_naming(bool enable)
{
/* But note we don't actually name them on Windows yet */
name_threads = enable;
+
+ fprintf(stderr, "qemu: thread naming not supported on this host\n");
}
static void error_exit(int err, const char *msg)