[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] qemu-progress: Fix progress printing on SIG
From: |
Benoît Canet |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] qemu-progress: Fix progress printing on SIGUSR1 |
Date: |
Tue, 21 Jan 2014 15:33:03 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Le Monday 20 Jan 2014 à 15:17:20 (+0100), Kevin Wolf a écrit :
> Since commit a7aae221 ('Switch SIG_IPI to SIGUSR1'), SIGUSR1 is blocked
> during startup, breaking the progress report in tools.
>
> This patch reenables the signal when initialising a progress report.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> util/qemu-progress.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/util/qemu-progress.c b/util/qemu-progress.c
> index ad33fee..4ee5cd0 100644
> --- a/util/qemu-progress.c
> +++ b/util/qemu-progress.c
> @@ -82,12 +82,22 @@ static void progress_dummy_init(void)
> {
> #ifdef CONFIG_POSIX
> struct sigaction action;
> + sigset_t set;
>
> memset(&action, 0, sizeof(action));
> sigfillset(&action.sa_mask);
> action.sa_handler = sigusr_print;
> action.sa_flags = 0;
> sigaction(SIGUSR1, &action, NULL);
> +
> + /*
> + * SIGUSR1 is SIG_IPI and gets blocked in qemu_init_main_loop(). In the
> + * tools that use the progress report SIGUSR1 isn't used in this meaning
> + * and instead should print the progress, so reenable it.
> + */
> + sigemptyset(&set);
> + sigaddset(&set, SIGUSR1);
> + pthread_sigmask(SIG_UNBLOCK, &set, NULL);
> #endif
>
> state.print = progress_dummy_print;
> --
> 1.8.1.4
>
>
I wonder if it worth it to restore the signal blocking state in
progress_dummy_end to avoid future side effects.
Reviewed-by: Benoit Canet <address@hidden>