From patchwork Wed Jun 15 16:48:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 882702 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5FGpA3G031109 for ; Wed, 15 Jun 2011 16:51:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751760Ab1FOQvH (ORCPT ); Wed, 15 Jun 2011 12:51:07 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=0HxU5W59AZFlFQHyVxiNphYYl7Lxrj0pLM9p5h0vEuM=; b=Dzg1oHNz5qrJB8Am6L+Uu6bSDQAAH0mJuG2w1ODPYIFB1mpwOATLh7XK8PVyLKdMWe h+ES/zLA+UsOUY35D5za8Yq+z7AzhMw05ptBcvQK3deh1L8P2CmubThn3OV5IKSJQk70 XTh1cbnpEMRvMUKWjlMz2vv6fVNXJ2kv+8WvU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=qaSERXtijpG3xmI9OvR7JlKtO+L4kMyBZiIeu/CNdOljRG2hzDCc5XuJ2RD7fv++pa 6YllX2t7/cZTYkfPtkPKVS4epvtT6LGjhB6hRyhn8NlDQYPdikbQAyi9IjVKIvMeiHSe T9TMcP6/EfAvmN7EUYxilK1XTpV+DbP+yeEUI= Received: by 10.68.34.74 with SMTP id x10mr507261pbi.175.1308156664808; Wed, 15 Jun 2011 09:51:04 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id k4sm363957pbl.11.2011.06.15.09.51.01 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 15 Jun 2011 09:51:04 -0700 (PDT) From: Asias He To: Pekka Enberg Cc: Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org, 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> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1308156491-18488-1-git-send-email-asias.hejun@gmail.com> References: <1308156491-18488-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 15 Jun 2011 16:51:10 +0000 (UTC) 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;