diff options
author | alfred <alfred@FreeBSD.org> | 2001-07-10 04:22:14 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2001-07-10 04:22:14 +0000 |
commit | d056d21c89604eae53a852ba51001cd89bc27d12 (patch) | |
tree | fea995714ffbc7475a040545b9e431e7309916dd | |
parent | 8cfb3274dd3ad25b06717366343ffd6b531dbdc2 (diff) | |
download | FreeBSD-src-d056d21c89604eae53a852ba51001cd89bc27d12.zip FreeBSD-src-d056d21c89604eae53a852ba51001cd89bc27d12.tar.gz |
Document some of the kernel API dealing with locks used primarily by VFS.
Submitted by: Chad David <davidc@acns.ab.ca>
-rw-r--r-- | share/man/man9/BUF_LOCK.9 | 65 | ||||
-rw-r--r-- | share/man/man9/BUF_LOCKFREE.9 | 58 | ||||
-rw-r--r-- | share/man/man9/BUF_LOCKINIT.9 | 58 | ||||
-rw-r--r-- | share/man/man9/BUF_REFCNT.9 | 57 | ||||
-rw-r--r-- | share/man/man9/BUF_TIMELOCK.9 | 79 | ||||
-rw-r--r-- | share/man/man9/BUF_UNLOCK.9 | 57 | ||||
-rw-r--r-- | share/man/man9/lockcount.9 | 60 | ||||
-rw-r--r-- | share/man/man9/lockdestroy.9 | 57 | ||||
-rw-r--r-- | share/man/man9/lockmgr.9 | 128 | ||||
-rw-r--r-- | share/man/man9/lockmgr_printinfo.9 | 58 | ||||
-rw-r--r-- | share/man/man9/lockstatus.9 | 81 |
11 files changed, 758 insertions, 0 deletions
diff --git a/share/man/man9/BUF_LOCK.9 b/share/man/man9/BUF_LOCK.9 new file mode 100644 index 0000000..3c5ce99 --- /dev/null +++ b/share/man/man9/BUF_LOCK.9 @@ -0,0 +1,65 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt BUF_LOCK 9 +.Os +.Sh NAME +.Nm BUF_LOCK +.Nd "Locks a buffer" +.Sh SYNOPSIS +.Fd #include <sys/buf.h> +.Ft int +.Fo BUF_LOCK +.Fa "struct buf *bp" +.Fa "int locktype" +.Fc +.Sh DESCRIPTION +The +.Nm +function locks the given buffer. If the lock is already held this +call will block until it can aquire the lock unless LK_NOWAIT is +set. +.Pp +Its arguments are: +.Bl -tag -width locktype +.It Ar bp +The buffer to lock. +.It Ar locktype +Flags controlling the type of lock. See lockmgr(9) for details. +.El +.Sh RETURN VALUES +A value of 0 is returned upon success. See lockmgr(9) for +information on non-zero return values. +.Sh SEE ALSO +.Xr buf 9 +.Xr lockmgr 9 +.Xr BUF_UNLOCK 9 +.Xr BUF_TIMELOCK 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/BUF_LOCKFREE.9 b/share/man/man9/BUF_LOCKFREE.9 new file mode 100644 index 0000000..3add14d --- /dev/null +++ b/share/man/man9/BUF_LOCKFREE.9 @@ -0,0 +1,58 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt BUF_LOCKFREE 9 +.Os +.Sh NAME +.Nm BUF_LOCKFREE +.Nd "Destroys the buffers lock" +.Sh SYNOPSIS +.Fd #include <sys/buf.h> +.Ft void +.Fo BUF_LOCKFREE +.Fa "struct buf *bp" +.Fc +.Sh DESCRIPTION +The +.Nm +macro destroys the buffer lock. The lock must not be held when +this macro is called or a panic will result. +.Pp +Its argument is: +.Bl -tag +.It Ar bp +The buffer whose lock is to be destroyed. +.Sh SEE ALSO +.Xr buf 9 +.Xr lockdestroy 9 +.Xr BUF_LOCK 9 +.Xr BUF_TIMELOCK 9 +.Xr BUF_UNLOCK 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/BUF_LOCKINIT.9 b/share/man/man9/BUF_LOCKINIT.9 new file mode 100644 index 0000000..c215c25 --- /dev/null +++ b/share/man/man9/BUF_LOCKINIT.9 @@ -0,0 +1,58 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt BUF_LOCKINIT 9 +.Os +.Sh NAME +.Nm BUF_LOCKINIT +.Nd "Unlocks a locked buffer" +.Sh SYNOPSIS +.Fd #include <sys/buf.h> +.Ft void +.Fo BUF_LOCKINIT +.Fa "struct buf *bp" +.Fc +.Sh DESCRIPTION +The +.Nm +macro initializes a buffer lock. +.Pp +Its argument is: +.Bl -tag +.It Ar bp +The buffer whose lock it to be initialized. +.Sh SEE ALSO +.Xr buf 9 +.Xr lockmgr 9 +.Xr lockinit 9 +.Xr BUF_LOCK 9 +.Xr BUF_TIMELOCK 9 +.Xr BUF_UNLOCK 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/BUF_REFCNT.9 b/share/man/man9/BUF_REFCNT.9 new file mode 100644 index 0000000..cdf50e7 --- /dev/null +++ b/share/man/man9/BUF_REFCNT.9 @@ -0,0 +1,57 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt BUF_REFCNT 9 +.Os +.Sh NAME +.Nm BUF_REFCNT +.Nd "Returns the reference count of the buffer lock" +.Sh SYNOPSIS +.Fd #include <sys/buf.h> +.Ft int +.Fo BUF_REFCNT +.Fa "struct buf *bp" +.Fc +.Sh DESCRIPTION +The +.Nm +function returns the reference count of the buffer lock. +.Pp +Its argument is: +.Bl -tag +.It Ar bp +The buffer whose lock reference count is to be returned. +.Sh SEE ALSO +.Xr buf 9 +.Xr lockcount 9 +.Xr BUF_LOCK 9 +.Xr BUF_TIMELOCK 9 +.Xr BUF_UNLOCK 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/BUF_TIMELOCK.9 b/share/man/man9/BUF_TIMELOCK.9 new file mode 100644 index 0000000..862eba8 --- /dev/null +++ b/share/man/man9/BUF_TIMELOCK.9 @@ -0,0 +1,79 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt BUF_LOCK 9 +.Os +.Sh NAME +.Nm BUF_LOCK +.Nd "Locks a buffer" +.Sh SYNOPSIS +.Fd #include <sys/buf.h> +.Ft int +.Fo BUF_LOCK +.Fa "struct buf *bp" +.Fa "int locktype" +.Fa "char *wmesg" +.Fa "int catch" +.Fa "int timo" +.Fc +.Sh DESCRIPTION +The +.Nm +function locks the given buffer, and limits the amount of time it +will sleep to +.Ar timo +and OR's +.Ar catch +into the sleep priority. +.Ar wmesg +is the wmesg used in the sleep. +.Pp +Its arguments are: +.Bl -tag -width locktype +.It Ar bp +The buffer to lock. +.It Ar locktype +Flags controlling the type of lock. See lockmgr(9) for details. +.It Ar wmesg +The wmesg used in any sleeps while aquiring the lock. +.It Ar catch +Priority OR'd into the sleep priority. +.It Ar timo +The timeout for any sleeps encountered during the lock. +.El +.Sh RETURN VALUE +A value of 0 is returned on success. See lockmgr(9) for +details on non-zero return values. +.Sh SEE ALSO +.Xr buf 9 +.Xr lockmgr 9 +.Xr BUF_UNLOCK 9 +.Xr BUF_TIMELOCK 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/BUF_UNLOCK.9 b/share/man/man9/BUF_UNLOCK.9 new file mode 100644 index 0000000..7b2373b --- /dev/null +++ b/share/man/man9/BUF_UNLOCK.9 @@ -0,0 +1,57 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt BUF_UNLOCK 9 +.Os +.Sh NAME +.Nm BUF_UNLOCK +.Nd "Unlocks a locked buffer" +.Sh SYNOPSIS +.Fd #include <sys/buf.h> +.Ft void +.Fo BUF_UNLOCK +.Fa "struct buf *bp" +.Fc +.Sh DESCRIPTION +The +.Nm +function unlocks a buffer that was previously locked with +BUF_LOCK or BUF_TIMELOCK. +.Pp +Its argument is: +.Bl -tag +.It Ar bp +The buffer to unlock. The buffer must already be locked. +.Sh SEE ALSO +.Xr buf 9 +.Xr lockmgr 9 +.Xr BUF_LOCK 9 +.Xr BUF_TIMELOCK 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/lockcount.9 b/share/man/man9/lockcount.9 new file mode 100644 index 0000000..5c83f66 --- /dev/null +++ b/share/man/man9/lockcount.9 @@ -0,0 +1,60 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt LOCKCOUNT 9 +.Os +.Sh NAME +.Nm lockcount +.Nd "Returns the reference count of a lock" +.Sh SYNOPSIS +.Fd #include <sys/lockmgr.h> +.Ft int +.Fo lockcount +.Fa "struct lock *lkp" +.Fc +.Sh DESCRIPTION +The +.Nm +function returns the reference count of the lock. The reference +count is the sum of exclusive locks and shared locks. +.Pp +Its arguments are: +.Bl -tag +.It Ar lkp +The lock to return the reference count on. +.El +.Sh RETURN VALUES +An integer greater than or equal to zero. +.Sh SEE ALSO +.Xr lockmgr 9 +.Xr lockdestroy 9 +.Xr lockstatus 9 +.Xr lockmgr_printinfo +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/lockdestroy.9 b/share/man/man9/lockdestroy.9 new file mode 100644 index 0000000..509db8e --- /dev/null +++ b/share/man/man9/lockdestroy.9 @@ -0,0 +1,57 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt LOCKDESTROY 9 +.Os +.Sh NAME +.Nm lockdestroy +.Nd "Destroys a lock" +.Sh SYNOPSIS +.Fd #include <sys/lockmgr.h> +.Ft int +.Fo lockdestroy +.Fa "struct lock *lkp" +.Fc +.Sh DESCRIPTION +The +.Nm +function destroys the given lock. (Currently is does nothing!) +.Pp +Its arguments are: +.Bl -tag +.It Ar lkp +The lock to destroy +.El +.Sh SEE ALSO +.Xr lockmgr 9 +.Xr lockcount 9 +.Xr lockstatus 9 +.Xr lockmgr_printinfo 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/lockmgr.9 b/share/man/man9/lockmgr.9 new file mode 100644 index 0000000..167875d --- /dev/null +++ b/share/man/man9/lockmgr.9 @@ -0,0 +1,128 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt LOCKMGR 9 +.Os +.Sh NAME +.Nm lockmgr +.Nd "Aquires, releases and updates locks" +.Sh SYNOPSIS +.Fd #include <sys/lockmgr.h> +.Ft int +.Fo lockmgr +.Fa "struct lock *lkp" +.Fa "u_int flags" +.Fa "struct mtx *interlkp" +.Fa "struct proc *p" +.Fc +.Sh DESCRIPTION +The +.Nm +function handles general locking functionality within the kernel, including +support for shared and exclusive locks, and recursion. Locks can also be +upgraded and downgraded. +.Pp +Its arguments are: +.Bl -tag -width interlkp +.It Ar lkp +A pointer to lock to manipulate.. +.It Ar flags +Flags indicating what action is to be taken. +.Pp +LK_SHARED - Aquire a shared lock. If we currently hold an exclusive lock it will +be downgraded. +.Pp +LK_EXCLUSIVE - Aquire an exclusive lock. If we already hold an exclusive lock +and LK_CANRECURSE is not set we will panic. +.Pp +LK_DOWNGRADE - Downgrade our exclusive lock to a shared lock. Downgrading a shared +lock is not valid. If the exclusive lock has been recursed, all references will +be downgraded. +.Pp +LK_EXCLUPGRADE - Upgrade our lock to an exclusive lock. Will fail with EBUSY if +there is someone ahead of use waiting for an upgrade. If this call fails we loose +our shared lock. Upgrading an exclusive lock will cause a panic. +.Pp +LK_UPGRADE - Upgrades our lock to an exclusive lock. If this call fails we loose +our shared lock. Upgrading an exclusive lock will cause a panic. +.Pp +LK_RELEASE - Release the lock. Releasing a lock that you do not hold can cause +a panic. +.Pp +LK_DRAIN - Waits for all activity on the lock to end, and then marks it decommissioned. +This is used before freeing a lock that is part of a piece of memory that is about to +be freed. (As documented in lockmgr.h) +.Pp +LK_SLEEPFAIL - the we slept for the lock then fail. +.Pp +LK_NOWAIT - Do not allow the call to sleep. This can be used to test the lock. +.Pp +LK_CANRECURSE - It is ok to recurse on an exclusive lock. For every lock there +must be a release. +.Pp +LK_INTERLOCK - Unlock the interlock, which is of course locked already. +.Pp +.It Ar interlkp +An interlock mutex for controlling group access to the lock. +If LK_INTERLOCK is specified +.Nm +assumes +.Ar interlkp +is currently owned and not recursed, and will return it unlocked. +See mtx_assert(9). +.It Ar p +The process responsible for this call. NULL becomes LK_KERNPROC. +.El +.Sh LOCKS +If LK_INTERLOCK is specified then +.Ar interlkp +must be held prior to calling +.Nm +and will be returned unlocked. +.Pp +Upgrade attempts that fail result in the loss of the lock that +is currently held. As well, it is not valid to upgrade an +exclusive lock, and a panic will be the result of trying. +.Sh RETURN VALUES +A value of 0 is returned on success. +.Sh ERRORS +.Bl -tag +.It Bq EBUSY +Either LK_NOWAIT was specified and lockmgr would have slept, or another +process was ahead of you in line for an exclusive upgrade. +.It Bq ENOLCK +LK_SLEEP_FAIL was set and we slept. +.Sh SEE ALSO +.Xr mutex 9 +.Xr lockcount 9 +.Xr lockdestroy 9 +.Xr lockstatus 9 +.Xr lockmgr_printinfo 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/lockmgr_printinfo.9 b/share/man/man9/lockmgr_printinfo.9 new file mode 100644 index 0000000..64b02e1 --- /dev/null +++ b/share/man/man9/lockmgr_printinfo.9 @@ -0,0 +1,58 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt LOCKMGR_PRINTINFO 9 +.Os +.Sh NAME +.Nm lockmgr_printinfo +.Nd "Prints information about the lock." +.Sh SYNOPSIS +.Fd #include <sys/lockmgr.h> +.Ft void +.Fo lockmgr_printinfo +.Fa "struct lock *lkp" +.Fc +.Sh DESCRIPTION +The +.Nm +function prints information about the lock including the lock +time and the wait count. +.Pp +Its arguments are: +.Bl -tag +.It Ar lkp +The lock to print. +.El +.Sh SEE ALSO +.Xr lockmgr 9 +.Xr lockcount 9 +.Xr lockdestroy 9 +.Xr lockstatus 9 +.Sh AUTHORS +This man page was written by Chad David. diff --git a/share/man/man9/lockstatus.9 b/share/man/man9/lockstatus.9 new file mode 100644 index 0000000..cb5ffea --- /dev/null +++ b/share/man/man9/lockstatus.9 @@ -0,0 +1,81 @@ +.\" +.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2001 +.Dt LOCKSTATUS 9 +.Os +.Sh NAME +.Nm lockstatus +.Nd "Returns the lock status" +.Sh SYNOPSIS +.Fd #include <sys/lockmgr.h> +.Ft int +.Fo lockstatus +.Fa "struct lock *lkp" +.Fa "struct proc *p" +.Fc +.Sh DESCRIPTION +The +.Nm +function returns the status of the lock in relation to the proc +passed to it. +.Pp +Its arguments are: +.Bl -tag +.It Ar lkp +The lock to return the status of. +.It Ar p +The process to check any exclusive locks against. If +.Ar p +is NULL and an exclusive lock is held +.Ar LK_EXCLUSIVE +is returned. +.El +.Sh RETURN VALUES +.Bl -tag +.It Ar LK_EXCLUSIVE +An exclusive lock is held by the process +.Ar p +passed in. +.It Ar LK_EXCLOTHER +An exclusive lock is held by someone other then the process +.Ar p +passed in. +.It Ar LK_SHARED +A shared lock is held. +count is the sum of exclusive locks and shared locks. +.It Ar 0 +The lock is not held by anyone. +.El +.Sh SEE ALSO +.Xr lockmgr 9 +.Xr lockcount 9 +.Xr lockdestroy 9 +.Xr lockmgr_printinfo 9 +.Sh AUTHORS +This man page was written by Chad David. |