[PATCH] *(int*)0 = 0 & variations

Riley Williams (rhw@MemAlpha.CX)
Wed, 23 Jun 1999 14:49:14 +0100 (GMT)


Hi there.

>> * assert()

> Very, very much needed. IMHO this should be enabled by default
> in experimental versions and disabled in stable versions.

Perhaps the following patch will help. It defines a kassert() macro
that reports the location where an assertion fails via printk with the
KERN_DEBUG reporting level, and should apply cleanly against ANY Linux
kernel release.

To enable it, define DEBUG before including it; to disable it, don't.

All that's required is for the relevant unit authors to add the
relevant calls to their units.

===8<=== CUT ===>8===
--- linux/include/linux/kassert.h~ Thu Jan 1 01:00:00 1970
+++ linux/include/linux/kassert.h Wed Jun 23 14:37:54 1999
@@ -0,0 +1,16 @@
+/*
+ * Include definitions for kernel assertion checking
+ */
+
+#ifndef __KASSERT_H__
+#define __KASSERT_H__
+
+#ifdef DEBUG
+#define kassert(cond) if (!(cond)) \
+ printk(KERN_DEBUG "ASSERTION FAILURE: %s line %u: %s\n", \
+ __FILE__, __LINE__, "cond")
+#else
+#define kassert(cond)
+#endif
+
+#endif
===8<=== CUT ===>8===

Best wishes from Riley.

+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/