diff options
author | Jan Kiszka | 2011-03-15 12:26:31 +0100 |
---|---|---|
committer | Marcelo Tosatti | 2011-03-16 21:11:07 +0100 |
commit | dc7a09cfe47679d89289101cc9eb387c45e48fe7 (patch) | |
tree | b55b3021443336fdb313dc41efe287355e3f21ea /os-posix.c | |
parent | kvm: x86: Push kvm_arch_debug to kvm_arch_handle_exit (diff) | |
download | qemu-dc7a09cfe47679d89289101cc9eb387c45e48fe7.tar.gz qemu-dc7a09cfe47679d89289101cc9eb387c45e48fe7.tar.xz qemu-dc7a09cfe47679d89289101cc9eb387c45e48fe7.zip |
Expose thread_id in info cpus
Based on patch by Glauber Costa:
To allow management applications like libvirt to apply CPU affinities to
the VCPU threads, expose their ID via info cpus. This patch provides the
pre-existing and used interface from qemu-kvm.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'os-posix.c')
-rw-r--r-- | os-posix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/os-posix.c b/os-posix.c index 38c29d1afe..7971f8620b 100644 --- a/os-posix.c +++ b/os-posix.c @@ -41,6 +41,7 @@ #ifdef CONFIG_LINUX #include <sys/prctl.h> +#include <sys/syscall.h> #endif #ifdef CONFIG_EVENTFD @@ -382,3 +383,12 @@ int qemu_create_pidfile(const char *filename) return 0; } + +int qemu_get_thread_id(void) +{ +#if defined (__linux__) + return syscall(SYS_gettid); +#else + return getpid(); +#endif +} |