From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Pekka Enberg <penberg@kernel.org>, Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>,
Asias He <asias.hejun@gmail.com>, KVM-ML <kvm@vger.kernel.org>
Subject: [PATCH] kvm tool: Introduce own BUG_ON handler
Date: Tue, 20 Dec 2011 20:58:35 +0400 [thread overview]
Message-ID: <20111220165835.GD12782@moon> (raw)
Raise SIGABRT in case if run-time crtitical
problem found.
Proposed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Ingo, you meant something like below?
tools/kvm/include/kvm/util.h | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
Index: linux-2.6.git/tools/kvm/include/kvm/util.h
===================================================================
--- linux-2.6.git.orig/tools/kvm/include/kvm/util.h
+++ linux-2.6.git/tools/kvm/include/kvm/util.h
@@ -9,7 +9,6 @@
* Some bits are stolen from perf tool :)
*/
-#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <stddef.h>
@@ -17,6 +16,7 @@
#include <stdarg.h>
#include <string.h>
#include <stdbool.h>
+#include <signal.h>
#include <errno.h>
#include <limits.h>
#include <sys/param.h>
@@ -51,9 +51,20 @@ extern void set_die_routine(void (*routi
__func__, __LINE__, ##__VA_ARGS__); \
} while (0)
-#
+
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#define BUG_ON(condition) assert(!(condition))
+
+#ifndef BUG_ON_HANDLER
+# define BUG_ON_HANDLER(condition) \
+ do { \
+ if ((condition)) { \
+ pr_err("BUG at %s:%d", __FILE__, __LINE__); \
+ raise(SIGABRT); \
+ } \
+ } while (0)
+#endif
+
+#define BUG_ON(condition) BUG_ON_HANDLER((condition))
#define DIE_IF(cnd) \
do { \
reply other threads:[~2011-12-20 16:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111220165835.GD12782@moon \
--to=gorcunov@gmail.com \
--cc=asias.hejun@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.