diff options
author | 2014-04-03 03:57:42 +0000 | |
---|---|---|
committer | 2014-04-03 03:57:42 +0000 | |
commit | 245c1722a222bae8d148495d0588631f56efc2b7 (patch) | |
tree | 59e5e960ffb20ae90519698a6e1becaa7bf6a336 /share/man/man9/lock.9 | |
parent | Fix syntax error in commented out local-zone entry. OK sthen@ (diff) | |
download | wireguard-openbsd-245c1722a222bae8d148495d0588631f56efc2b7.tar.xz wireguard-openbsd-245c1722a222bae8d148495d0588631f56efc2b7.zip |
lies lies lies lies lies
Diffstat (limited to '')
-rw-r--r-- | share/man/man9/lock.9 | 96 |
1 files changed, 5 insertions, 91 deletions
diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9 index 89b5a8aa359..91a19db4a81 100644 --- a/share/man/man9/lock.9 +++ b/share/man/man9/lock.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: lock.9,v 1.20 2013/06/04 19:27:08 schwarze Exp $ +.\" $OpenBSD: lock.9,v 1.21 2014/04/03 03:57:42 tedu Exp $ .\" $NetBSD: lock.9,v 1.12 2001/11/01 01:13:43 wiz Exp $ .\" .\" Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -25,110 +25,43 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: June 4 2013 $ +.Dd $Mdocdate: April 3 2014 $ .Dt LOCK 9 .Os .Sh NAME .Nm lock , -.Nm simple_lock_init , -.Nm simple_lock , -.Nm simple_lock_try , -.Nm simple_unlock , .Nm lockinit , .Nm lockmgr , -.Nm lockstatus , -.Nm lockmgr_printinfo , +.Nm lockstatus .Nd kernel lock functions .Sh SYNOPSIS .In sys/lock.h .Ft void -.Fn simple_lock_init "struct simplelock *slock" -.Ft void -.Fn simple_lock "struct simplelock *slock" -.Ft int -.Fn simple_lock_try "struct simplelock *slock" -.Ft void -.Fn simple_unlock "struct simplelock *slock" -.Ft void .Fn lockinit "struct lock *lock" "int prio" "const char *wmesg" \ "int timo" "int flags" .Ft int .Fn lockmgr "struct lock *lock" "u_int flags" "struct simplelock *slock" .Ft int .Fn lockstatus "struct lock *lock" -.Ft void -.Fn lockmgr_printinfo "struct lock *lock" .Sh DESCRIPTION The .Nm functions provide synchronisation in the kernel by preventing multiple processes from simultaneously executing critical sections of code accessing shared data. -A number of different locks are available: -.Bl -tag -width Ds -.It struct simplelock -Provides a simple spinning mutex. -A processor will busy-wait while trying to acquire a simplelock. -The simplelock operations are -implemented with machine-dependent locking primitives. .Pp -Simplelocks are usually used only by the high-level lock manager and -to protect short, critical sections of code. -Simplelocks are the only -locks that can be used inside an interrupt handler. -For a simplelock to be used in an interrupt handler, care must be taken to -disable the interrupt, acquire the lock, do any processing, release -the simplelock and re-enable the interrupt. -This procedure is necessary to avoid deadlock between the interrupt handler -and other processes executing on the same processor. -.It struct lock -Provides a high-level lock supporting sleeping/spinning until the lock -can be acquired. +struct lock supports sleeping until the lock can be acquired. The lock manager supplies both exclusive-access and shared-access locks, with recursive exclusive-access locks within a single process. It also allows upgrading a shared-access lock to an exclusive-access lock, as well as downgrading an exclusive-access lock to a shared-access lock. -.El .Pp If the kernel option LOCKDEBUG is enabled, additional facilities are provided to record additional lock information. These facilities are provided to assist in determining deadlock occurrences. .Sh FUNCTIONS -The functions which operate on simplelocks are: -.Bl -tag -width Ds -.It Fn simple_lock_init "slock" -The simplelock -.Fa slock -is initialised to the unlocked state. -.It Fn simple_lock "slock" -The simplelock -.Fa slock -is locked. -If the simplelock is held then execution will -spin until the simplelock is acquired. -Care must be taken that the calling process does not already hold -the simplelock. -In this case, the simplelock can never be acquired. -If kernel option LOCKDEBUG is enabled, a "locking against myself" panic -will occur. -.It Fn simple_lock_try "slock" -Try to acquire the simplelock -.Fa slock -without spinning. -If the simplelock is held by another process then the return value is 0. -If the simplelock was acquired successfully then the return value is 1. -.It Fn simple_unlock "slock" -The simplelock -.Fa slock -is unlocked. -The simplelock must be locked and the calling process must -be the one that last acquired the simplelock. -If the calling process does not hold the simplelock, the simplelock -will be released but the kernel behaviour is undefined. -.El -.Pp The functions which operate on locks are: .Bl -tag -width Ds .It Fn lockinit "lock" "prio" "wmesg" "timo" "flags" @@ -202,9 +135,6 @@ Determine the status of lock .Fa lock . Returns LK_EXCLUSIVE or LK_SHARED for exclusive-access and shared-access locks respectively. -.It Fn lockmgr_printinfo "lock" -Print out information about state of lock -.Fa lock . .El .Sh RETURN VALUES Successfully acquired locks return 0. @@ -223,22 +153,6 @@ the system call is restarted. .It Bq Er EWOULDBLOCK Non-null lock timeout and timeout expires. .El -.Sh CODE REFERENCES -This section describes places within the -.Ox -source tree where actual code implementing or utilising the locking -framework can be found. -All pathnames are relative to -.Pa /usr/src . -.Pp -The locking framework itself is implemented within the file -.Pa sys/kern/kern_lock.c . -Data structures and function prototypes for the framework are located -in -.Pa sys/sys/lock.h . -.\"Machine-dependent simplelock primitives are implemented within the -.\"file -.\".Pa sys/arch/\*[Lt]arch\*[Gt]/include/lock.h . .Sh SEE ALSO .Xr mutex 9 , .Xr pmap 9 , @@ -248,6 +162,6 @@ in .Xr uvm 9 .Sh HISTORY The kernel locking API first appeared in -.Bx 4.4 -lite2 . +.Bx 4.4 lite2 . It was progressively deprecated in favor of .Xr rwlock 9 . |