qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] main-loop.c: Handle SIGINT, SIGHUP and SIGTERM


From: Gonglei
Subject: Re: [Qemu-devel] [PATCH] main-loop.c: Handle SIGINT, SIGHUP and SIGTERM synchronously
Date: Sat, 25 Oct 2014 19:34:42 +0800

Hi,

> Subject: [Qemu-devel] [PATCH] main-loop.c: Handle SIGINT, SIGHUP and
> SIGTERM synchronously
> 
> Add the termination signals SIGINT, SIGHUP and SIGTERM to the
> list of signals which we handle synchronously via a signalfd.
> This avoids a race condition where if we took the SIGTERM
> in the middle of qemu_shutdown_requested:
>     int r = shutdown_requested;
> [SIGTERM here...]
>     shutdown_requested = 0;
> 
> then the setting of the shutdown_requested flag by
> termsig_handler() would be lost and QEMU would fail to
> shut down. This was causing 'make check' to hang occasionally.
> 
> Signed-off-by: Peter Maydell <address@hidden>

I met a really upset thing after this patch, which I can't using gdb debug
Qemu process well. I use gdb attaching a Qemu process, and press 'c' to continue
executing. When I want to set a breakpoint for debugging, then press 'ctrl + c',
the Qemu will exit, because the SIGINT signal is captured by Qemu now. :(

What's your opinion? Thanks.

Best regards,
-Gonglei

> Cc: address@hidden
> ---
>  main-loop.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/main-loop.c b/main-loop.c
> index 3cc79f8..8746abc 100644
> --- a/main-loop.c
> +++ b/main-loop.c
> @@ -84,6 +84,9 @@ static int qemu_signal_init(void)
>      sigaddset(&set, SIGIO);
>      sigaddset(&set, SIGALRM);
>      sigaddset(&set, SIGBUS);
> +    sigaddset(&set, SIGINT);
> +    sigaddset(&set, SIGHUP);
> +    sigaddset(&set, SIGTERM);
>      pthread_sigmask(SIG_BLOCK, &set, NULL);
> 
>      sigdelset(&set, SIG_IPI);
> --
> 1.9.1
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]