summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/Makefile4
-rw-r--r--share/man/man9/VOP_LOOKUP.955
-rw-r--r--share/man/man9/lock.9173
-rw-r--r--share/man/man9/mutex.95
-rw-r--r--share/man/man9/rwlock.98
-rw-r--r--share/man/man9/vnsubr.932
6 files changed, 69 insertions, 208 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index a580ae1d73a..20cfd3248db 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.277 2016/06/17 13:23:21 mglocker Exp $
+# $OpenBSD: Makefile,v 1.278 2016/06/19 11:54:33 natano Exp $
# $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -20,7 +20,7 @@ MAN= aml_evalnode.9 atomic_add_int.9 atomic_cas_uint.9 \
ieee80211_radiotap.9 if_get.9 if_rxr_init.9 ifq_enqueue.9 \
ifq_deq_begin.9 iic.9 intro.9 inittodr.9 intr_barrier.9 \
kern.9 km_alloc.9 knote.9 kthread.9 ktrace.9 \
- loadfirmware.9 lock.9 log.9 \
+ loadfirmware.9 log.9 \
malloc.9 membar_sync.9 mbuf.9 mbuf_tags.9 md5.9 mi_switch.9 \
microtime.9 ml_init.9 mq_init.9 mutex.9 \
namei.9 \
diff --git a/share/man/man9/VOP_LOOKUP.9 b/share/man/man9/VOP_LOOKUP.9
index 773ed80b0b3..b9dfdefc04c 100644
--- a/share/man/man9/VOP_LOOKUP.9
+++ b/share/man/man9/VOP_LOOKUP.9
@@ -1,6 +1,7 @@
-.\" $OpenBSD: VOP_LOOKUP.9,v 1.35 2016/05/23 09:31:28 natano Exp $
+.\" $OpenBSD: VOP_LOOKUP.9,v 1.36 2016/06/19 11:54:33 natano Exp $
.\"
.\" Copyright (c) 2003 Ted Unangst
+.\" Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -23,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 23 2016 $
+.Dd $Mdocdate: June 19 2016 $
.Dt VOP_LOOKUP 9
.Os
.Sh NAME
@@ -565,17 +566,55 @@ to lock a vnode.
It should not be used by other file system code.
.Fn VOP_UNLOCK
unlocks a vnode.
-.Fn VOP_ISLOCKED
-returns 1 if
-.Fa vp
-is locked and 0 if not.
-It should be used cautiously, as not all file systems implement locks
-effectively.
Note the asymmetry between
.Xr vn_lock 9
and
.Fn VOP_UNLOCK .
.Pp
+.Fa flags
+may contain the following flags:
+.Pp
+.Bl -tag -width LK_RECURSEFAIL -compact -offset indent
+.It Dv LK_EXCLUSIVE
+Acquire an exclusive lock.
+.It Dv LK_SHARED
+Acquire a shared lock.
+.It Dv LK_NOWAIT
+Don't wait if the vnode lock is held by someone else
+(may still wait on reclamation lock).
+.It Dv LK_RECURSEFAIL
+Attempt at recursive lock fails.
+.It Dv LK_DRAIN
+Wait for all activity on the lock to end, then mark it decommissioned.
+This feature is used to ensure that no other activity can occur while the
+underlying object of a vnode is being cleaned out.
+Must be used in combination with
+.Dv LK_EXCLUSIVE .
+.El
+.Pp
+.Fn VOP_ISLOCKED
+returns one of the following values:
+.Pp
+.Bl -tag -width LK_EXCLUSIVE -compact -offset indent
+.It Dv LK_EXCLUSIVE
+.Fa vp
+is locked for exclusive access by the calling thread.
+.It Dv LK_EXCLOTHER
+.Fa vp
+is locked for exclusive access by a different thread.
+.It Dv LK_SHARED
+.Fa vp
+is locked for shared access.
+The current thread may be one of the threads that have it locked.
+.It 0
+.Fa vp
+is not locked.
+.El
+.Pp
+.Fn VOP_ISLOCKED
+should be used cautiously, as not all file systems implement locks
+effectively.
+.Pp
.It Fn VOP_KQFILTER vp kn
Register the
.Xr knote 9
diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9
deleted file mode 100644
index b22dd54e6bc..00000000000
--- a/share/man/man9/lock.9
+++ /dev/null
@@ -1,173 +0,0 @@
-.\" $OpenBSD: lock.9,v 1.23 2015/01/11 19:34:52 guenther Exp $
-.\" $NetBSD: lock.9,v 1.12 2001/11/01 01:13:43 wiz Exp $
-.\"
-.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd $Mdocdate: January 11 2015 $
-.Dt LOCK 9
-.Os
-.Sh NAME
-.Nm lock ,
-.Nm lockinit ,
-.Nm lockmgr ,
-.Nm lockstatus
-.Nd kernel lock functions
-.Sh SYNOPSIS
-.In sys/lock.h
-.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"
-.Sh DESCRIPTION
-The
-.Nm
-functions provide synchronisation in the kernel by preventing multiple
-processes from simultaneously executing critical sections of code
-accessing shared data.
-.Pp
-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.
-.Sh FUNCTIONS
-The functions which operate on locks are:
-.Bl -tag -width Ds
-.It Fn lockinit "lock" "prio" "wmesg" "timo" "flags"
-The lock
-.Fa lock
-is initialised according to the parameters provided.
-Arguments are as follows:
-.Pp
-.Bl -tag -width Ds -compact
-.It Fa lock
-The lock.
-.It Fa prio
-The process priority when it is woken up after sleeping on the lock.
-.It Fa wmesg
-A sleep message used when a process goes to sleep waiting for the lock, so
-that the exact reason it is sleeping can easily be identified.
-.It Fa timo
-The maximum sleep time.
-Used by
-.Xr tsleep 9 .
-.It Fa flags
-Flags to specify the lock behaviour permanently over the lifetime of
-the lock.
-Valid lock flags are:
-.Pp
-.Bl -tag -width "LK_CANRECURSEXX" -compact
-.It LK_NOWAIT
-Processes should not sleep when attempting to acquire the lock.
-.It LK_CANRECURSE
-Processes can acquire the lock recursively.
-.El
-.El
-.It Fn lockmgr "lock" "flags" "slock"
-Set, change or release a lock according to the parameters provided.
-Arguments are as follows:
-.Pp
-.Bl -tag -width Ds -compact
-.It Fa lock
-The lock.
-.It Fa flags
-Flags to specify the lock request type.
-In addition to the flags specified above, the following flags are valid:
-.Bl -tag -width Ds
-.It LK_SHARED
-Get one of many possible shared-access locks.
-If a process holding an exclusive-access lock requests a shared-access lock,
-the exclusive-access lock is downgraded to a shared-access lock.
-.It LK_EXCLUSIVE
-Stop further shared-access locks, when they are cleared, grant a
-pending upgrade if it exists, then grant an exclusive-access lock.
-Only one exclusive-access lock may exist at a time, except that a
-process holding an exclusive-access lock may get additional
-exclusive-access locks if it explicitly sets the LK_CANRECURSE flag in
-the lock request, or if the LK_CANRECURSE flag was set when the lock
-was initialised.
-.It LK_RELEASE
-Release one instance of a lock.
-.It LK_DRAIN
-Wait for all activity on the lock to end, then mark it decommissioned.
-This feature is used before freeing a lock that is part of a piece of
-memory that is about to be freed.
-.It LK_RECURSEFAIL
-Attempt at recursive lock fails.
-.El
-.Pp
-.It Fa slock
-This argument exists for legacy reasons, it is now ignored.
-.El
-.It Fn lockstatus "lock"
-Returns the current state of lock
-.Fa lock .
-.Pp
-.Bl -tag -width "LK_EXCLUSIVE" -offset indent -compact
-.It Dv LK_EXCLUSIVE
-Lock is locked for exclusive-access by the calling thread.
-.It Dv LK_EXCLOTHER
-Lock is locked for exclusive-access by a different thread.
-.It Dv LK_SHARED
-Lock is locked for shared-access.
-The current thread may be one of the threads that has it locked.
-.It 0
-Lock is not locked.
-.El
-.El
-.Sh RETURN VALUES
-Successfully acquired locks return 0.
-A failed lock attempt always returns a non-zero error value.
-No lock is held after an error return.
-Locks will always succeed unless one of the following is true:
-.Bl -tag -width Er
-.It Bq Er EBUSY
-LK_NOWAIT is set and a sleep would be required.
-.It Bq Er EINTR
-PCATCH is set in lock priority and a signal arrives to interrupt
-a system call.
-.It Bq Er ERESTART
-PCATCH is set in lock priority and a signal arrives so that
-the system call is restarted.
-.It Bq Er EWOULDBLOCK
-Non-null lock timeout and timeout expires.
-.El
-.Sh SEE ALSO
-.Xr mutex 9 ,
-.Xr pmap 9 ,
-.Xr rwlock 9 ,
-.Xr spl 9 ,
-.Xr tsleep 9 ,
-.Xr uvm 9
-.Sh HISTORY
-The kernel locking API first appeared in
-.Bx 4.4 lite2 .
-It was progressively deprecated in favor of
-.Xr rwlock 9 .
diff --git a/share/man/man9/mutex.9 b/share/man/man9/mutex.9
index 661a74d2e52..abbaac9e91b 100644
--- a/share/man/man9/mutex.9
+++ b/share/man/man9/mutex.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mutex.9,v 1.22 2014/02/13 14:23:05 jmc Exp $
+.\" $OpenBSD: mutex.9,v 1.23 2016/06/19 11:54:33 natano Exp $
.\"
.\" Copyright (c) 2005 Pedro Martelletto <pedro@ambientworks.net>
.\" All rights reserved.
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 13 2014 $
+.Dd $Mdocdate: June 19 2016 $
.Dt MUTEX 9
.Os
.Sh NAME
@@ -104,7 +104,6 @@ function will return non-zero if it succeeds in acquiring the mutex
.Fa mtxp ,
otherwise it will return 0.
.Sh SEE ALSO
-.Xr lockmgr 9 ,
.Xr msleep 9 ,
.Xr rwlock 9 ,
.Xr spl 9
diff --git a/share/man/man9/rwlock.9 b/share/man/man9/rwlock.9
index 57680476300..46080d7486c 100644
--- a/share/man/man9/rwlock.9
+++ b/share/man/man9/rwlock.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rwlock.9,v 1.17 2014/07/09 18:00:09 jmc Exp $
+.\" $OpenBSD: rwlock.9,v 1.18 2016/06/19 11:54:33 natano Exp $
.\"
.\" Copyright (c) 2006 Pedro Martelletto <pedro@ambientworks.net>
.\" All rights reserved.
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 9 2014 $
+.Dd $Mdocdate: June 19 2016 $
.Dt RWLOCK 9
.Os
.Sh NAME
@@ -183,8 +183,8 @@ can be called during autoconf, from process context, or from interrupt context.
.Pp
All other functions can be called during autoconf or from process context.
.Sh SEE ALSO
-.Xr lockmgr 9 ,
-.Xr mutex 9
+.Xr mutex 9 ,
+.Xr spl 9
.Sh HISTORY
The
.Nm
diff --git a/share/man/man9/vnsubr.9 b/share/man/man9/vnsubr.9
index 97e54cd9b81..805aeb3c683 100644
--- a/share/man/man9/vnsubr.9
+++ b/share/man/man9/vnsubr.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: vnsubr.9,v 1.11 2011/09/03 22:59:07 jmc Exp $
+.\" $OpenBSD: vnsubr.9,v 1.12 2016/06/19 11:54:33 natano Exp $
.\" $NetBSD: vnsubr.9,v 1.21 2004/05/25 14:54:56 hannken Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: September 3 2011 $
+.Dd $Mdocdate: June 19 2016 $
.Dt VNSUBR 9
.Os
.Sh NAME
@@ -125,23 +125,19 @@ Instead, the
.Xr vget 9
function should be used.
.Pp
-The
+In addition to the
.Fa flags
-argument may contain the following flags:
-.Pp
-.Bl -tag -width LK_EXCLUSIVE -offset indent -compact
-.It Dv LK_RETRY
-Return the vnode even if it has been reclaimed.
-.It Dv LK_NOWAIT
-Don't wait if the vnode lock is held by someone else
-(may still wait on reclamation lock).
-Must not be used with
-.Dv LK_RETRY .
-.It Dv LK_EXCLUSIVE
-Acquire an exclusive lock.
-.It Dv LK_SHARED
-Acquire a shared lock.
-.El
+accepted by
+.Xr VOP_LOCK 9 ,
+the
+.Dv LK_RETRY
+flag may be used.
+.Dv LK_RETRY
+causes
+.Fn vn_lock
+to return the vnode even if it has been reclaimed.
+It must not be used with
+.Dv LK_NOWAIT .
.Pp
The
.Fn vn_lock