yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qemu-progress-Fix-progress-printing-on-SIGUSR1.patch

9ae3a8
From a06249cc31c0f8c2ae37c7e0ff047a922a265e7c Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Tue, 11 Feb 2014 16:24:43 +0100
9ae3a8
Subject: [PATCH 26/28] qemu-progress: Fix progress printing on SIGUSR1
9ae3a8
9ae3a8
RH-Author: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Message-id: <1392135884-10508-3-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 57223
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH 2/3] qemu-progress: Fix progress printing on SIGUSR1
9ae3a8
Bugzilla: 997878
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
Since commit a7aae221 ('Switch SIG_IPI to SIGUSR1'), SIGUSR1 is blocked
9ae3a8
during startup, breaking the progress report in tools.
9ae3a8
9ae3a8
This patch reenables the signal when initialising a progress report.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Benoit Canet <benoit@irqsave.net>
9ae3a8
(cherry picked from commit 3c4b4e383e82ab3db307ee01f12ab0d4a28584dc)
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 util/qemu-progress.c | 10 ++++++++++
9ae3a8
 1 file changed, 10 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 util/qemu-progress.c |   10 ++++++++++
9ae3a8
 1 files changed, 10 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/util/qemu-progress.c b/util/qemu-progress.c
9ae3a8
index ad33fee..4ee5cd0 100644
9ae3a8
--- a/util/qemu-progress.c
9ae3a8
+++ b/util/qemu-progress.c
9ae3a8
@@ -82,12 +82,22 @@ static void progress_dummy_init(void)
9ae3a8
 {
9ae3a8
 #ifdef CONFIG_POSIX
9ae3a8
     struct sigaction action;
9ae3a8
+    sigset_t set;
9ae3a8
 
9ae3a8
     memset(&action, 0, sizeof(action));
9ae3a8
     sigfillset(&action.sa_mask);
9ae3a8
     action.sa_handler = sigusr_print;
9ae3a8
     action.sa_flags = 0;
9ae3a8
     sigaction(SIGUSR1, &action, NULL);
9ae3a8
+
9ae3a8
+    /*
9ae3a8
+     * SIGUSR1 is SIG_IPI and gets blocked in qemu_init_main_loop(). In the
9ae3a8
+     * tools that use the progress report SIGUSR1 isn't used in this meaning
9ae3a8
+     * and instead should print the progress, so reenable it.
9ae3a8
+     */
9ae3a8
+    sigemptyset(&set);
9ae3a8
+    sigaddset(&set, SIGUSR1);
9ae3a8
+    pthread_sigmask(SIG_UNBLOCK, &set, NULL);
9ae3a8
 #endif
9ae3a8
 
9ae3a8
     state.print = progress_dummy_print;
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8