All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] qemu-progress: Fix progress printing on SIGUSR1
Date: Tue, 21 Jan 2014 15:33:03 +0100	[thread overview]
Message-ID: <20140121143302.GK9834@irqsave.net> (raw)
In-Reply-To: <1390227441-28854-3-git-send-email-kwolf@redhat.com>

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 <kwolf@redhat.com>
> ---
>  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 <benoit@irqsave.net>

  reply	other threads:[~2014-01-21 14:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 14:17 [Qemu-devel] [PATCH 0/3] qemu-img: Fix progress printing on SIGUSR1 Kevin Wolf
2014-01-20 14:17 ` [Qemu-devel] [PATCH 1/3] qemu-progress: Drop unused include Kevin Wolf
2014-01-21 14:30   ` Benoît Canet
2014-01-20 14:17 ` [Qemu-devel] [PATCH 2/3] qemu-progress: Fix progress printing on SIGUSR1 Kevin Wolf
2014-01-21 14:33   ` Benoît Canet [this message]
2014-01-20 14:17 ` [Qemu-devel] [PATCH 3/3] Documentation: qemu-img: Mention SIGUSR1 progress report Kevin Wolf
2014-01-21 14:36   ` Benoît Canet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140121143302.GK9834@irqsave.net \
    --to=benoit.canet@irqsave.net \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.