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

Jeff Garzik (jgarzik@pobox.com)
Wed, 23 Jun 1999 10:00:17 -0400


assert should definitely be more informative, and an assertion failure
is more than a debug statement. The following functions more like the
userland version:

#ifndef NDEBUG
# define kassert(cond) \
if (!(cond)) { \
printk (KERN_ERR "kassert failed in function %s, file %s, line %d:
%s\n", \
__FUNCTION__, \
__FILE__, \
__LINE__, \
__STRING(cond)); \
*(int*)0 = 0; \
}
#else
# define kassert(cond)
#endif

You could put some additional switches in there to enable or disable the
oops after the printk, or to change KERN_ERR to something else.

Jeff

-
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/