1.\" 2.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org> 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" 26.\" $FreeBSD$ 27.\" 28.Dd July 19, 2003 29.Dt vm_map_lock 9 30.Sh NAME 31.Nm vm_map_lock , 32.Nm vm_map_unlock , 33.Nm vm_map_lock_read , 34.Nm vm_map_unlock_read , 35.Nm vm_map_trylock , 36.Nm vm_map_trylock_read , 37.Nm vm_map_lock_upgrade , 38.Nm vm_map_lock_downgrade 39.Nd vm_map locking macros 40.Sh SYNOPSIS 41.In sys/param.h 42.In vm/vm.h 43.In vm/vm_map.h 44.Ft void 45.Fn vm_map_lock "vm_map_t map" 46.Ft void 47.Fn vm_map_unlock "vm_map_t map" 48.Ft void 49.Fn vm_map_lock_read "vm_map_t map" 50.Ft void 51.Fn vm_map_unlock_read "vm_map_t map" 52.Ft int 53.Fn vm_map_trylock "vm_map_t map" 54.Ft int 55.Fn vm_map_trylock_read "vm_map_t map" 56.Ft int 57.Fn vm_map_lock_upgrade "vm_map_t map" 58.Ft int 59.Fn vm_map_lock_downgrade "vm_map_t map" 60.Sh DESCRIPTION 61The 62.Fn vm_map_lock 63macro obtains an exclusive lock on 64.Fa map . 65.Pp 66The 67.Fn vm_map_unlock 68macro releases an exclusive lock on 69.Fa map . 70.Pp 71The 72.Fn vm_map_lock_read 73macro obtains a read-lock on 74.Fa map . 75Currently this is implemented as an exclusive lock. 76.Pp 77The 78.Fn vm_map_unlock_read 79macro releases a read-lock on 80.Fa map . 81.Pp 82The 83.Fn vm_map_trylock 84macro attempts to obtain an exclusive lock on 85.Fa map . 86It returns FALSE if the lock cannot be immediately acquired; 87otherwise return TRUE with the lock acquired. 88.Pp 89The 90.Fn vm_map_trylock_read 91macro attempts to obtain a read-lock on 92.Fa map . 93It returns FALSE if the lock cannot be immediately acquired; 94otherwise return TRUE with the lock acquired. 95Currently this is implemented as an exclusive lock. 96.Pp 97The 98.Fn vm_map_lock_upgrade 99macro attempts to atomically upgrade a read-lock on 100.Fa map 101to an exclusive lock. 102As read-locks are currently implemented as exclusive locks, 103this macro is a no-op. 104.Pp 105The 106.Fn vm_map_lock_downgrade 107macro attempts to downgrade an exclusive lock on 108.Fa map 109to a read-lock. 110As read-locks are currently implemented as exclusive locks, 111this macro is a no-op. 112.Sh IMPLEMENTATION NOTES 113Currently, all of the locking macros implement their locks as sleep locks. 114.Sh SEE ALSO 115.Xr vm_map 9 116.Sh AUTHORS 117This man page was written by 118.An Bruce M Simpson Aq bms@spc.org . 119