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_wire 9 30.Sh NAME 31.Nm vm_map_wire , 32.Nm vm_map_unwire 33.Nd manage page wiring within a virtual memory map 34.Sh SYNOPSIS 35.In sys/param.h 36.In vm/vm.h 37.In vm/vm_map.h 38.Ft int 39.Fn vm_map_wire "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags" 40.Ft int 41.Fn vm_map_unwire "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags" 42.Sh DESCRIPTION 43The 44.Fn vm_map_wire 45function is responsible for wiring pages in the range between 46.Fa start 47and 48.Fa end 49within the map 50.Fa map . 51Wired pages are locked into physical memory, and may not be paged out 52as long as their wire count remains above zero. 53.Pp 54The 55.Fn vm_map_unwire 56function performs the corresponding unwire operation. 57.Pp 58The 59.Fa flags 60argument is a bit mask, consisting of the following flags: 61.Pp 62If the 63.Dv VM_MAP_WIRE_USER 64flag is set, the function operates within user address space. 65.Pp 66If the 67.Dv VM_MAP_WIRE_HOLESOK 68flag is set, it may operate upon an arbitrary range within the 69address space of 70.Fa map . 71.Pp 72If a contiguous range is desired, callers should explicitly express 73their intent by specifying the 74.Dv VM_MAP_WIRE_NOHOLES 75flag. 76.Sh IMPLEMENTATION NOTES 77Both functions will attempt to acquire a lock on the map using 78.Xr vm_map_lock 9 79and hold it for the duration of the call. 80If they detect 81.Dv MAP_ENTRY_IN_TRANSITION , 82they will call 83.Xr vm_map_unlock_and_wait 9 84until the map becomes available again. 85.Pp 86The map could have changed during this window as it was held by another 87consumer, therefore consumers of this interface should check for this 88condition using the return values below. 89.Sh RETURN VALUES 90The 91.Fn vm_map_wire 92and 93.Fn vm_map_unwire 94functions have identical return values. 95The functions return 96.Dv KERN_SUCCESS 97if all pages within the range were [un]wired successfully. 98.Pp 99Otherwise, if the specified range was not valid, 100or if the map changed while the MAP_ENTRY_IN_TRANSITION flag was set, 101.Dv KERN_INVALID_ADDRESS 102is returned. 103.Sh SEE ALSO 104.Xr mlockall 2 , 105.Xr munlockall 2 , 106.Xr vm_map 9 107.Sh AUTHORS 108This man page was written by 109.An Bruce M Simpson Aq bms@spc.org . 110