- Add notes about SX_SYSINIT and MTX_SYSINIT in order to document the

recent additions of these macros.
- Add in a MLINK to create SX_SYSINIT.9 and MTX_SYSINIT.9.
This commit is contained in:
arr 2002-04-02 17:21:00 +00:00
parent 448edc64b4
commit 85f5ae7a3b
3 changed files with 30 additions and 3 deletions

View File

@ -203,6 +203,7 @@ MLINKS+=sx.9 sx_sunlock.9
MLINKS+=sx.9 sx_xunlock.9
MLINKS+=sx.9 sx_try_upgrade.9
MLINKS+=sx.9 sx_downgrade.9
MLINKS+=sx.9 SX_SYSINIT.9
MLINKS+=time.9 boottime.9 time.9 mono_time.9 time.9 runtime.9
MLINKS+=timeout.9 untimeout.9
MLINKS+=timeout.9 callout_handle_init.9 timeout.9 callout_init.9
@ -322,6 +323,7 @@ MLINKS+=mutex.9 mtx_unlock_spin.9 mutex.9 mtx_unlock_spin_flags.9
MLINKS+=mutex.9 mtx_destroy.9
MLINKS+=mutex.9 mtx_initialized.9 mutex.9 mtx_owned.9
MLINKS+=mutex.9 mtx_recursed.9 mutex.9 mtx_assert.9
MLINKS+=mutex.9 MTX_SYSINIT.9
MLINKS+=kobj.9 kobj_class_compile.9
MLINKS+=kobj.9 kobj_class_compile_static.9

View File

@ -48,7 +48,8 @@
.Nm mtx_initialized ,
.Nm mtx_owned ,
.Nm mtx_recursed ,
.Nm mtx_assert
.Nm mtx_assert,
.Nm MTX_SYSINIT
.Nd kernel synchronization primitives
.Sh SYNOPSIS
.In sys/param.h
@ -86,6 +87,7 @@
.Fn mtx_recursed "struct mtx *mutex"
.Ft void
.Fn mtx_assert "struct mtx *mutex" "int what"
.Fn MTX_SYSINIT "name" "mtx" "description" "opts"
.Sh DESCRIPTION
Mutexes are the most basic and primary method of process synchronization.
The major design considerations for mutexes are:
@ -360,6 +362,16 @@ pointed to by the first argument.
This assertion is only valid in conjunction with
.Dv MA_OWNED .
.El
.Pp
The
.Fn MTX_SYSINIT
macro is used to generate a call to the
.Fn mtx_sysinit
routine at system startup in order to initialize a given mutex lock. The parameters are the same as
.Fn mtx_init
but with an additional argument,
.Fa name,
that is used in generating unique variable names for the related structures associated with the lock and the sysinit routine.
.Ss The Default Mutex Type
Most kernel code should use the default lock type,
.Dv MTX_DEF ;

View File

@ -41,7 +41,8 @@
.Nm sx_xunlock ,
.Nm sx_try_upgrade ,
.Nm sx_downgrade ,
.Nm sx_assert
.Nm sx_assert,
.Nm SX_SYSINIT
.Nd kernel shared/exclusive lock
.Sh SYNOPSIS
.In sys/param.h
@ -70,6 +71,7 @@
.Fn sx_downgrade "struct sx *sx"
.Ft void
.Fn sx_assert "struct sx *sx" "int what"
.Fn SX_SYSINIT "name" "sx" "description"
.Sh DESCRIPTION
Shared/exclusive locks are used to protect data that are read far more often
than they are written.
@ -106,7 +108,7 @@ lock by calling
A thread that owns an exclusive lock can downgrade it to a shared lock by
calling
.Fn sx_downgrade .
.Pp
.PP
.Fn sx_try_slock
and
.Fn sx_try_xlock
@ -124,6 +126,17 @@ The
function tests specified conditions and panics if they are not met and the
kernel is compiled with
.Dv INVARIANTS .
.Pp
The
.Fn SX_SYSINIT
macro is used to generate a call to the
.Fn sx_sysinit
routine at system startup in order to initialize a given sx lock. The parameters are the same as
.Fn sx_init
but with an additional argument,
.Fa name,
that is used in generating unique variable names for the related structures associated with the lock and the sysinit routine.
.Pp
The following assertions are supported:
.Bl -tag -width ".Dv SX_XLOCKED"
.It Dv SX_LOCKED