Add "options INVARIANTS" and "options INVARIANT_SUPPORT" to the

synopsis, with supporting text in the body of the manual page.

Add a cross-reference to panic(9) for completeness.

Reviewed by:	ru (synopsis changes)
This commit is contained in:
Joseph Koshy 2004-01-01 05:16:35 +00:00
parent f50ad9a10c
commit de77c1ba47
2 changed files with 25 additions and 7 deletions

View File

@ -85,6 +85,9 @@
.Fn mtx_owned "struct mtx *mutex"
.Ft int
.Fn mtx_recursed "struct mtx *mutex"
.Pp
.Cd "options INVARIANTS"
.Cd "options INVARIANT_SUPPORT"
.Ft void
.Fn mtx_assert "struct mtx *mutex" "int what"
.In sys/kernel.h
@ -330,11 +333,15 @@ This check should only be made if the running thread already owns
.Pp
The
.Fn mtx_assert
function allows assertions to be made about
function allows assertions specified in
.Ar what
to be made about
.Fa mutex .
If the assertions are not true and the kernel is compiled with
.Dv INVARIANTS
then the kernel will panic.
.Cd "options INVARIANTS"
and
.Cd "options INVARIANT_SUPPORT" ,
the kernel will panic.
Currently the following assertions are supported:
.Bl -tag -width MA_NOTRECURSED
.It Dv MA_OWNED
@ -493,6 +500,7 @@ No locks are needed when calling these functions.
.Xr condvar 9 ,
.Xr msleep 9 ,
.Xr mtx_pool 9 ,
.Xr panic 9 ,
.Xr sema 9 ,
.Xr sx 9
.Sh HISTORY

View File

@ -68,6 +68,9 @@
.Fn sx_try_upgrade "struct sx *sx"
.Ft void
.Fn sx_downgrade "struct sx *sx"
.Pp
.Cd "options INVARIANTS"
.Cd "options INVARIANT_SUPPORT"
.Ft void
.Fn sx_assert "struct sx *sx" "int what"
.In sys/kernel.h
@ -121,11 +124,17 @@ will return 0 if the shared lock cannot be upgraded to an exclusive lock
immediately; otherwise the exclusive lock will be acquired and a non-zero value
will be returned.
.Pp
The
When compiled with
.Cd "options INVARIANTS"
and
.Cd "options INVARIANT_SUPPORT" ,
the
.Fn sx_assert
function tests specified conditions and panics if they are not met and the
kernel is compiled with
.Dv INVARIANTS .
function tests
.Ar sx
for the assertions specified in
.Ar what
and panics if they are not met.
The following assertions are supported:
.Bl -tag -width ".Dv SX_XLOCKED"
.It Dv SX_LOCKED
@ -166,6 +175,7 @@ It is allowed to own a shared lock or an exclusive lock while sleeping.
.Xr condvar 9 ,
.Xr mtx_pool 9 ,
.Xr mutex 9 ,
.Xr panic 9 ,
.Xr sema 9
.Sh BUGS
Currently there is no way to assert that a lock is not held.