aboutsummaryrefslogtreecommitdiff
path: root/share/man/man9/lock.9
diff options
context:
space:
mode:
Diffstat (limited to 'share/man/man9/lock.9')
-rw-r--r--share/man/man9/lock.971
1 files changed, 66 insertions, 5 deletions
diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9
index 110fdd68fda0..9cff6e3bd8aa 100644
--- a/share/man/man9/lock.9
+++ b/share/man/man9/lock.9
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.Dd November 17, 2017
+.Dd June 21, 2024
.Dt LOCK 9
.Os
.Sh NAME
@@ -34,9 +34,14 @@
.Nm lockmgr_args ,
.Nm lockmgr_args_rw ,
.Nm lockmgr_disown ,
+.Nm lockmgr_disowned ,
+.Nm lockmgr_lock_flags ,
.Nm lockmgr_printinfo ,
.Nm lockmgr_recursed ,
.Nm lockmgr_rw ,
+.Nm lockmgr_slock ,
+.Nm lockmgr_unlock ,
+.Nm lockmgr_xlock ,
.Nm lockstatus ,
.Nm lockmgr_assert
.Nd "lockmgr family of functions"
@@ -56,6 +61,10 @@
.Fn lockmgr_args_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk" "const char *wmesg" "int prio" "int timo"
.Ft void
.Fn lockmgr_disown "struct lock *lkp"
+.Ft int
+.Fn lockmgr_disowned "const struct lock *lkp"
+.Ft int
+.Fn lockmgr_lock_flags "struct lock *lkp" "u_int flags" "struct lock_object *ilk" "const char *file" "int line"
.Ft void
.Fn lockmgr_printinfo "const struct lock *lkp"
.Ft int
@@ -63,6 +72,12 @@
.Ft int
.Fn lockmgr_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk"
.Ft int
+.Fn lockmgr_slock "struct lock *lkp" "u_int flags" "const char *file" "int line"
+.Ft int
+.Fn lockmgr_unlock "struct lock *lkp"
+.Ft int
+.Fn lockmgr_xlock "struct lock *lkp" "u_int flags" "const char *file" "int line"
+.Ft int
.Fn lockstatus "const struct lock *lkp"
.Pp
.Cd "options INVARIANTS"
@@ -108,10 +123,6 @@ should log messages about duplicate locks being acquired.
Disable
.Xr ktr 4
logging for this lock.
-.It Dv LK_TIMELOCK
-Use
-.Fa timo
-during a sleep; otherwise, 0 is used.
.El
.El
.Pp
@@ -182,6 +193,10 @@ Fail if operation has slept.
.It Dv LK_NOWAIT
Do not allow the call to sleep.
This can be used to test the lock.
+.It Dv LK_TIMELOCK
+Use
+.Fa timo
+during a sleep; otherwise, 0 is used.
.It Dv LK_NOWITNESS
Skip the
.Xr witness 4
@@ -253,12 +268,55 @@ and
.Dv LK_TIMO_DEFAULT .
.Pp
The
+.Fn lockmgr_lock_flags
+function works like
+.Fn lockmgr
+but accepts explicit
+.Fa file
+and
+.Fa line
+arguments for lock tracing.
+.Pp
+The
+.Fn lockmgr_slock ,
+.Fn lockmgr_xlock ,
+and
+.Fn lockmgr_unlock
+functions are lightweight entry points that function like
+.Fn lockmgr
+for the
+.Dv LK_SHARED ,
+.Dv LK_EXCLUSIVE ,
+and
+.Dv LK_RELEASE
+operations respectively.
+They provide functionality similar to
+.Xr sx 9
+locks in that none of the additional
+.Xr lockmgr 9
+features are supported.
+Specifically, these functions do not support unlocking interlocks, the
+.Dv LK_SLEEPFAIL
+flag, or locks with shared locking disabled via
+.Dv LK_NOSHARE .
+They also accept explicit
+.Fa file
+and
+.Fa line
+arguments for lock tracing.
+.Pp
+The
.Fn lockmgr_disown
function switches the owner from the current thread to be
.Dv LK_KERNPROC ,
if the lock is already held.
.Pp
The
+.Fn lockmgr_disowned
+function returns true or false according to whether the lock is held by
+.Dv LK_KERNPROC .
+.Pp
+The
.Fn lockmgr_printinfo
function prints debugging information about the lock.
It is used primarily by
@@ -354,6 +412,8 @@ was requested and another thread had already requested a lock upgrade.
was set, and a sleep would have been required, or
.Dv LK_TRYUPGRADE
operation was not able to upgrade the lock.
+.It Bq Er EDEADLK
+A shared lock was attempted while the thread already held the exclusive lock.
.It Bq Er ENOLCK
.Dv LK_SLEEPFAIL
was set and
@@ -398,6 +458,7 @@ exclusive lock, and a
.Xr panic 9
will be the result of trying.
.Sh SEE ALSO
+.Xr witness 4 ,
.Xr condvar 9 ,
.Xr locking 9 ,
.Xr mtx_assert 9 ,