X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=util%2Fqemu-progress.c;h=aa994668f1c4a7b5c6c78551623f24f4accadc1d;hb=82d53adfbb1aa0dbe7dac09b61ad86014efe81a7;hp=9a3f96cd47077b3d49f52c57e098e86ce05e7e06;hpb=a507db9599599ce33007b524276a6ea88e521662;p=qmiga%2Fqemu.git diff --git a/util/qemu-progress.c b/util/qemu-progress.c index 9a3f96cd47..aa994668f1 100644 --- a/util/qemu-progress.c +++ b/util/qemu-progress.c @@ -22,10 +22,8 @@ * THE SOFTWARE. */ -#include "qemu-common.h" #include "qemu/osdep.h" -#include "sysemu/sysemu.h" -#include +#include "qemu/qemu-progress.h" struct progress_state { float current; @@ -83,12 +81,25 @@ 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); +#ifdef SIGINFO + sigaction(SIGINFO, &action, NULL); +#endif + + /* + * 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; @@ -120,7 +131,7 @@ void qemu_progress_end(void) /* * Report progress. * @delta is how much progress we made. - * If @max is zero, @delta is an absolut value of the total job done. + * If @max is zero, @delta is an absolute value of the total job done. * Else, @delta is a progress delta since the last call, as a fraction * of @max. I.e. the delta is @delta * @max / 100. This allows * relative accounting of functions which may be a different fraction of @@ -143,7 +154,8 @@ void qemu_progress_print(float delta, int max) state.current = current; if (current > (state.last_print + state.min_skip) || - (current == 100) || (current == 0)) { + current < (state.last_print - state.min_skip) || + current == 100 || current == 0) { state.last_print = state.current; state.print(); }