From patchwork Wed Jun 15 16:48:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 882652 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 p5FGooNL030900 for ; Wed, 15 Jun 2011 16:50:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751274Ab1FOQur (ORCPT ); Wed, 15 Jun 2011 12:50:47 -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 S1751106Ab1FOQur (ORCPT ); Wed, 15 Jun 2011 12:50:47 -0400 Received: by pzk9 with SMTP id 9so395991pzk.19 for ; Wed, 15 Jun 2011 09:50:46 -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; bh=8N0fFKt8ItQ7x7h3IQUJbx5q0qL9Dua88l17Wi6pdWQ=; b=rubCcZUaOsveWybc0aCyTjiTRZUDQ1Sz33S+TgyH478TkflxXPcblc2ZZMH2h7OXut 9GLMi8dB2UNrGNqC3cuRZyLpXQW9aBWKFqUU9lqGzPtMjW6JTLw4mZOvMlsHfAFFFof8 I0c0ceWJmEXmfYJ8YlrHeSY8AB5u4005qyu90= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=xeYNmWmP29vZL45ahBI18L83c++i3iMDjSUKEWC+QfzGtSoitXDwpeBOEhyLd/9oJP sX9Er9rXksR3nR0npBiST2jMNMZPoB3BBvMXQ3VrxeiHzyjZBA0toHoKGdtvrA//Xc8l iS0LluX+4IIGAx3daSyZ+c2+kqP9lcLka5Vm0= Received: by 10.68.43.193 with SMTP id y1mr487489pbl.168.1308156646598; Wed, 15 Jun 2011 09:50:46 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id k4sm363957pbl.11.2011.06.15.09.50.43 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 15 Jun 2011 09:50:45 -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 1/6] kvm tools: Introduce a helper to block a singal for a thread Date: Thu, 16 Jun 2011 00:48:06 +0800 Message-Id: <1308156491-18488-1-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.5.4 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:50:50 +0000 (UTC) Signed-off-by: Asias He --- tools/kvm/include/kvm/util.h | 2 ++ tools/kvm/util.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/tools/kvm/include/kvm/util.h b/tools/kvm/include/kvm/util.h index a9425cc..95d86b9 100644 --- a/tools/kvm/include/kvm/util.h +++ b/tools/kvm/include/kvm/util.h @@ -68,4 +68,6 @@ static inline const char *skip_prefix(const char *str, const char *prefix) return strncmp(str, prefix, len) ? NULL : str + len; } +int sig_block(int n); + #endif /* KVM__UTIL_H */ diff --git a/tools/kvm/util.c b/tools/kvm/util.c index 4efbce9..204230e 100644 --- a/tools/kvm/util.c +++ b/tools/kvm/util.c @@ -3,6 +3,7 @@ */ #include "kvm/util.h" +#include static void report(const char *prefix, const char *err, va_list params) { @@ -99,3 +100,15 @@ size_t strlcat(char *dest, const char *src, size_t count) return res; } + +int sig_block(int n) +{ + sigset_t sigset; + int ret; + + sigemptyset(&sigset); + sigaddset(&sigset, n); + ret = pthread_sigmask(SIG_BLOCK, &sigset, NULL); + + return ret; +}