Re: INVARIANTS in sys/sys/sx.h

From: Ruslan Ermilov <ru_at_freebsd.org>
Date: Mon, 28 Aug 2006 23:53:36 +0400
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

Received on Mon Aug 28 2006 - 17:53:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:59 UTC