INVARIANTS in sys/sys/sx.h

Ruslan Ermilov ru at freebsd.org
Mon Aug 28 19:53:17 UTC 2006


On Mon, Aug 28, 2006 at 11:38:47PM +0900, Jun Kuriyama wrote:
> 
> I found this when I compiled my kernel with INVARIANTS without
> INVARIANT_SUPPORT.
> 
> In src/sys/sys/sx.h, _sx_assert() is defined in INVARIANT_SUPPORT,
> 
> > #ifdef INVARIANT_SUPPORT
> > void	_sx_assert(struct sx *sx, int what, const char *file, int line);
> > #endif
> 
> but sx_assert() uses this function in INVARIANTS option.
> 
> > #ifdef INVARIANTS
> > #define	sx_assert(sx, what)	_sx_assert((sx), (what), LOCK_FILE, LOCK_LINE)
> > #else
> > #define	sx_assert(sx, what)
> > #endif
> 
> Is this consistent?
> 
Well, yes.  The idea is that you can compile your entire kernel
with INVARIANT_SUPPORT and only certain files with INVARIANTS.
I believe this info is in the NOTES files... yes it is:

: #
: # The INVARIANT_SUPPORT option makes us compile in support for
: # verifying some of the internal structures.  It is a prerequisite for
: # 'INVARIANTS', as enabling 'INVARIANTS' will make these functions be
: # called.  The intent is that you can set 'INVARIANTS' for single
: # source files (by changing the source file or specifying it on the
: # command line) if you have 'INVARIANT_SUPPORT' enabled.  Also, if you
: # wish to build a kernel module with 'INVARIANTS', then adding
: # 'INVARIANT_SUPPORT' to your kernel will provide all the necessary
: # infrastructure without the added overhead.
: #
: options 	INVARIANT_SUPPORT


Cheers,
-- 
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20060828/fe7862ff/attachment.pgp


More information about the freebsd-current mailing list