qemu-img: Fix progress printing on SIGUSR1
cover qemu-img: Fix progress printing on SIGUSR1
Kevin Wolf (3):
qemu-progress: Drop unused include
qemu-progress: Fix progress printing on SIGUSR1
Documentation: qemu-img: Mention SIGUSR1 progress report
qemu-img.texi | 4 +++- util/qemu-progress.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/3 qemu-progress: Drop unused include
--- util/qemu-progress.c | 1 - 1 file changed, 1 deletion(-)
util/qemu-progress.c +0 -1
@@ -24,7 +24,6 @@#include "qemu-common.h" #include "qemu/osdep.h" -#include "sysemu/sysemu.h" #include <stdio.h> struct progress_state {
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH 1/3] qemu-progress: Drop unused include
Quoted 21 lines · Kevin Wolf
Signed-off-by Kevin Wolf <[email protected]>--- util/qemu-progress.c | 1 - 1 file changed, 1 deletion(-)util/qemu-progress.c +0
-1@@ -24,7 +24,6 @@#include "qemu-common.h" #include "qemu/osdep.h" -#include "sysemu/sysemu.h" #include <stdio.h> struct progress_state {Signature · 1 line
1.8.1.4
PATCH 2/3 qemu-progress: Fix progress printing on SIGUSR1
In reply to Kevin WolfSince 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.
--- util/qemu-progress.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
util/qemu-progress.c +10 -0
@@ -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;
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH 2/3] qemu-progress: Fix progress printing on SIGUSR1
Quoted 41 lines · Kevin Wolf
Since commit
a7aae221('SwitchSIG_IPIto 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 <[email protected]>--- util/qemu-progress.c | 10 ++++++++++ 1 file changed, 10 insertions(+)util/qemu-progress.c +10
-0@@ -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;Signature · 1 line
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.
PATCH 3/3 Documentation: qemu-img: Mention SIGUSR1 progress report
In reply to Kevin WolfDocument the SIGUSR1 behaviour of qemu-img. Also, added compare to the list of subcommands that support -p.
--- qemu-img.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
qemu-img.texi +3 -1
@@ -57,7 +57,9 @@ indicates that target image must be compressed (qcow format only) @item -h with or without a command shows help and lists the supported formats @item -p -display progress bar (convert and rebase commands only) +display progress bar (compare, convert and rebase commands only). +If the @var{-p} option is not used for a command that supports it, the +progress is reported when the process receives a @code{SIGUSR1} signal. @item -q Quiet mode - do not print any output (except errors). There's no progress bar in case both @var{-q} and @var{-p} options are used.
Signature · 1 line
1.8.1.4
Re: [Qemu-devel] [PATCH 3/3] Documentation: qemu-img: Mention SIGUSR1 progress report
Quoted 27 lines · Kevin Wolf
Document the SIGUSR1 behaviour of qemu-img. Also, added compare to the list of subcommands that support -p.
Signed-off-by Kevin Wolf <[email protected]>--- qemu-img.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)qemu-img.texi +3
-1@@ -57,7 +57,9 @@ indicates that target image must be compressed (qcow format only) @item -h with or without a command shows help and lists the supported formats @item -p -display progress bar (convert and rebase commands only) +display progress bar (compare, convert and rebase commands only). +If the @var{-p} option is not used for a command that supports it, the +progress is reported when the process receives a @code{SIGUSR1} signal. @item -q Quiet mode - do not print any output (except errors). There's no progress bar in case both @var{-q} and @var{-p} options are used.Signature · 1 line
1.8.1.4