[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/17] Move win32 early signal handling setup to os_
From: |
Jes . Sorensen |
Subject: |
[Qemu-devel] [PATCH 06/17] Move win32 early signal handling setup to os_setup_signal_handling() |
Date: |
Fri, 4 Jun 2010 15:24:31 +0200 |
From: Jes Sorensen <address@hidden>
Move win32 early signal handling setup to os_setup_signal_handling()
Signed-off-by: Jes Sorensen <address@hidden>
---
os-win32.c | 29 +++++++++++++++++++++++++++++
vl.c | 30 ------------------------------
2 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/os-win32.c b/os-win32.c
index 1f7e28b..dfa90bc 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -152,3 +152,32 @@ void os_host_main_loop_wait(int *timeout)
*timeout = 0;
}
+
+static BOOL WINAPI qemu_ctrl_handler(DWORD type)
+{
+ exit(STATUS_CONTROL_C_EXIT);
+ return TRUE;
+}
+
+void os_setup_signal_handling(void)
+{
+ /* Note: cpu_interrupt() is currently not SMP safe, so we force
+ QEMU to run on a single CPU */
+ HANDLE h;
+ DWORD mask, smask;
+ int i;
+
+ SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE);
+
+ h = GetCurrentProcess();
+ if (GetProcessAffinityMask(h, &mask, &smask)) {
+ for(i = 0; i < 32; i++) {
+ if (mask & (1 << i))
+ break;
+ }
+ if (i != 32) {
+ mask = 1 << i;
+ SetProcessAffinityMask(h, mask);
+ }
+ }
+}
diff --git a/vl.c b/vl.c
index 7a46fee..f43456a 100644
--- a/vl.c
+++ b/vl.c
@@ -1986,14 +1986,6 @@ static int balloon_parse(const char *arg)
return -1;
}
-#ifdef _WIN32
-static BOOL WINAPI qemu_ctrl_handler(DWORD type)
-{
- exit(STATUS_CONTROL_C_EXIT);
- return TRUE;
-}
-#endif
-
#ifndef _WIN32
static void termsig_handler(int signal)
@@ -2459,29 +2451,7 @@ int main(int argc, char **argv, char **envp)
qemu_cache_utils_init(envp);
QLIST_INIT (&vm_change_state_head);
-#ifndef _WIN32
os_setup_signal_handling();
-#else
- SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE);
- /* Note: cpu_interrupt() is currently not SMP safe, so we force
- QEMU to run on a single CPU */
- {
- HANDLE h;
- DWORD mask, smask;
- int i;
- h = GetCurrentProcess();
- if (GetProcessAffinityMask(h, &mask, &smask)) {
- for(i = 0; i < 32; i++) {
- if (mask & (1 << i))
- break;
- }
- if (i != 32) {
- mask = 1 << i;
- SetProcessAffinityMask(h, mask);
- }
- }
- }
-#endif
module_call_init(MODULE_INIT_MACHINE);
machine = find_default_machine();
--
1.6.5.2
- [Qemu-devel] [PATCH 14/17] Move daemonize handling to OS specific files, (continued)
- [Qemu-devel] [PATCH 14/17] Move daemonize handling to OS specific files, Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 05/17] Introduce os-posix.c and create os_setup_signal_handling(), Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 11/17] Introduce OS specific cmdline argument handling and move SMB arg to os-posix.c, Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 07/17] Rename os_setup_signal_handling() to os_setup_early_signal_handling(), Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 16/17] Move line-buffering setup to OS specific files., Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 10/17] Rename qemu-options.h to qemu-options.def, Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 15/17] Make os_change_process_uid and os_change_root os-posix.c local, Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 17/17] Move set_proc_name() to OS specific files., Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 12/17] Move runas handling from vl.c to OS specific files., Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 06/17] Move win32 early signal handling setup to os_setup_signal_handling(),
Jes . Sorensen <=
- [Qemu-devel] [PATCH 09/17] Move find_datadir to OS specific files., Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 04/17] vl.c: Move host_main_loop_wait() to OS specific files., Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 13/17] Move chroot handling to OS specific files., Jes . Sorensen, 2010/06/04
- [Qemu-devel] [PATCH 03/17] Introduce os-win32.c and move polling functions from vl.c, Jes . Sorensen, 2010/06/04