[PATCH 6/6] kvm tools: Introduce a helper to show the blocked signals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This helper shows  the blocked signals of the calling thread.

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux