mirror of https://github.com/xemu-project/xemu.git
Move win32 early signal handling setup to os_setup_signal_handling()
Move win32 early signal handling setup to os_setup_signal_handling() Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Richard Henderson <rth@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
86b645e753
commit
69bd73b1b0
29
os-win32.c
29
os-win32.c
|
@ -152,3 +152,32 @@ void os_host_main_loop_wait(int *timeout)
|
||||||
|
|
||||||
*timeout = 0;
|
*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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,4 @@ static inline void os_host_main_loop_wait(int *timeout)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void os_setup_signal_handling(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
2
sysemu.h
2
sysemu.h
|
@ -79,6 +79,8 @@ int qemu_loadvm_state(QEMUFile *f);
|
||||||
/* SLIRP */
|
/* SLIRP */
|
||||||
void do_info_slirp(Monitor *mon);
|
void do_info_slirp(Monitor *mon);
|
||||||
|
|
||||||
|
void os_setup_signal_handling(void);
|
||||||
|
|
||||||
typedef enum DisplayType
|
typedef enum DisplayType
|
||||||
{
|
{
|
||||||
DT_DEFAULT,
|
DT_DEFAULT,
|
||||||
|
|
30
vl.c
30
vl.c
|
@ -1986,14 +1986,6 @@ static int balloon_parse(const char *arg)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
static BOOL WINAPI qemu_ctrl_handler(DWORD type)
|
|
||||||
{
|
|
||||||
exit(STATUS_CONTROL_C_EXIT);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
static void termsig_handler(int signal)
|
static void termsig_handler(int signal)
|
||||||
|
@ -2459,29 +2451,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
qemu_cache_utils_init(envp);
|
qemu_cache_utils_init(envp);
|
||||||
|
|
||||||
QLIST_INIT (&vm_change_state_head);
|
QLIST_INIT (&vm_change_state_head);
|
||||||
#ifndef _WIN32
|
|
||||||
os_setup_signal_handling();
|
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);
|
module_call_init(MODULE_INIT_MACHINE);
|
||||||
machine = find_default_machine();
|
machine = find_default_machine();
|
||||||
|
|
Loading…
Reference in New Issue