KASSERT in kernel module outside src/sys

Stefan Farfeleder stefan at fafoe.narf.at
Wed Dec 13 00:51:04 PST 2006


On Tue, Dec 12, 2006 at 05:03:24PM -0800, Kevin Sanders wrote:
> On 12/12/06, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:
> >On Tue, Dec 12, 2006 at 02:30:41PM -0800, Kevin Sanders wrote:
> >> I'm trying to use KASSERT in my own kernel module and I can't get it
> >> to assert even with a KASSERT(0, "test panic").  Is there something
> >> else I need to do besides add options INVARIANTS to my kernel config
> >> file.  Any clues would be appreciated.
> >
> >Tried
> >CFLAGS+=        -DINVARIANTS
> >in the Makefile of the module?
> 
> Thanks all.  That almost works, I'm getting a syntax error before
> string constant.

You need a pair of parentheses around the message:

  KASSERT(0, ("test panic"))

Stefan


More information about the freebsd-hackers mailing list