From: Asias He Subject: [PATCH 6/6] kvm tools: Introduce a helper to show the blocked signals Date: Thu, 16 Jun 2011 00:48:11 +0800 Message-ID: <1308156491-18488-6-git-send-email-asias.hejun@gmail.com> References: <1308156491-18488-1-git-send-email-asias.hejun@gmail.com> Cc: Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org, Asias He To: Pekka Enberg Return-path: Received: from mail-pz0-f46.google.com ([209.85.210.46]:61786 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751804Ab1FOQvF (ORCPT ); Wed, 15 Jun 2011 12:51:05 -0400 Received: by mail-pz0-f46.google.com with SMTP id 9so395991pzk.19 for ; Wed, 15 Jun 2011 09:51:04 -0700 (PDT) In-Reply-To: <1308156491-18488-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: This helper shows the blocked signals of the calling thread. Signed-off-by: Asias He --- tools/kvm/include/kvm/util.h | 1 + tools/kvm/util.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/tools/kvm/include/kvm/util.h b/tools/kvm/include/kvm/util.h index 95d86b9..6fd0f7e 100644 --- a/tools/kvm/include/kvm/util.h +++ b/tools/kvm/include/kvm/util.h @@ -68,6 +68,7 @@ static inline const char *skip_prefix(const char *str, const char *prefix) return strncmp(str, prefix, len) ? NULL : str + len; } +void sig_prt_blocked(const char *str); int sig_block(int n); #endif /* KVM__UTIL_H */ diff --git a/tools/kvm/util.c b/tools/kvm/util.c index 204230e..2f2dcf6 100644 --- a/tools/kvm/util.c +++ b/tools/kvm/util.c @@ -101,6 +101,23 @@ size_t strlcat(char *dest, const char *src, size_t count) return res; } +void sig_prt_blocked(const char *str) +{ + sigset_t sigset; + int i; + + printf("-> %s : Blocked sig: ", str); + + if (pthread_sigmask(0, NULL, &sigset) < 0) + return; + for (i = 1; i < _NSIG; i++) { + if (sigismember(&sigset, i)) + printf("%d ", i); + } + printf("\n"); + +} + int sig_block(int n) { sigset_t sigset; -- 1.7.5.4