17d216f0fSBruce M Simpson.\" 27d216f0fSBruce M Simpson.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org> 37d216f0fSBruce M Simpson.\" All rights reserved. 47d216f0fSBruce M Simpson.\" 57d216f0fSBruce M Simpson.\" Redistribution and use in source and binary forms, with or without 67d216f0fSBruce M Simpson.\" modification, are permitted provided that the following conditions 77d216f0fSBruce M Simpson.\" are met: 87d216f0fSBruce M Simpson.\" 1. Redistributions of source code must retain the above copyright 97d216f0fSBruce M Simpson.\" notice, this list of conditions and the following disclaimer. 107d216f0fSBruce M Simpson.\" 2. Redistributions in binary form must reproduce the above copyright 117d216f0fSBruce M Simpson.\" notice, this list of conditions and the following disclaimer in the 127d216f0fSBruce M Simpson.\" documentation and/or other materials provided with the distribution. 137d216f0fSBruce M Simpson.\" 147d216f0fSBruce M Simpson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 157d216f0fSBruce M Simpson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 167d216f0fSBruce M Simpson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 177d216f0fSBruce M Simpson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 187d216f0fSBruce M Simpson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 197d216f0fSBruce M Simpson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 207d216f0fSBruce M Simpson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 217d216f0fSBruce M Simpson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 227d216f0fSBruce M Simpson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 237d216f0fSBruce M Simpson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 247d216f0fSBruce M Simpson.\" SUCH DAMAGE. 257d216f0fSBruce M Simpson.\" 267d216f0fSBruce M Simpson.Dd July 19, 2003 27a970c85cSRuslan Ermilov.Dt VM_MAP_FINDSPACE 9 28b4ca3754SRuslan Ermilov.Os 297d216f0fSBruce M Simpson.Sh NAME 307d216f0fSBruce M Simpson.Nm vm_map_findspace 317d216f0fSBruce M Simpson.Nd find a free region within a map 327d216f0fSBruce M Simpson.Sh SYNOPSIS 337d216f0fSBruce M Simpson.In sys/param.h 347d216f0fSBruce M Simpson.In vm/vm.h 357d216f0fSBruce M Simpson.In vm/vm_map.h 367d216f0fSBruce M Simpson.Ft int 37a970c85cSRuslan Ermilov.Fo vm_map_findspace 38a970c85cSRuslan Ermilov.Fa "vm_map_t map" "vm_offset_t start" "vm_size_t length" "vm_offset_t *addr" 39a970c85cSRuslan Ermilov.Fc 407d216f0fSBruce M Simpson.Sh DESCRIPTION 417d216f0fSBruce M SimpsonThe 427d216f0fSBruce M Simpson.Fn vm_map_findspace 437d216f0fSBruce M Simpsonfunction attempts to find a region with sufficient space in the 447d216f0fSBruce M Simpson.Fa map 457d216f0fSBruce M Simpsonfor an object of size 467d216f0fSBruce M Simpson.Fa length 477d216f0fSBruce M Simpsonat the address 487d216f0fSBruce M Simpson.Fa addr . 497d216f0fSBruce M Simpson.Sh IMPLEMENTATION NOTES 507d216f0fSBruce M SimpsonIt is the caller's responsibility to obtain a lock on the 517d216f0fSBruce M Simpson.Fa map 527d216f0fSBruce M Simpsonusing 537d216f0fSBruce M Simpson.Xr vm_map_lock 9 547d216f0fSBruce M Simpsonbefore calling this function. 557d216f0fSBruce M Simpson.Pp 567d216f0fSBruce M SimpsonThis routine may call 577d216f0fSBruce M Simpson.Xr pmap_growkernel 9 587d216f0fSBruce M Simpsonto grow the kernel's address space, if and only if the mapping is being 597d216f0fSBruce M Simpsonmade within the kernel address space, and if insufficient space remains 607d216f0fSBruce M Simpsonin the 61a970c85cSRuslan Ermilov.Va kernel_map . 627d216f0fSBruce M Simpson.Sh RETURN VALUES 637d216f0fSBruce M SimpsonThe 647d216f0fSBruce M Simpson.Fn vm_map_findspace 657d216f0fSBruce M Simpsonfunction returns the value 0 if successful, and 667d216f0fSBruce M Simpson.Fa *addr 677d216f0fSBruce M Simpsonwill contain the first virtual address in the found region; 687d216f0fSBruce M Simpsonotherwise, the value 1 is returned. 697d216f0fSBruce M Simpson.Sh SEE ALSO 707d216f0fSBruce M Simpson.Xr pmap_growkernel 9 , 717d216f0fSBruce M Simpson.Xr vm_map 9 , 72c9768082SAlan Cox.Xr vm_map_entry_resize_free 9 , 737d216f0fSBruce M Simpson.Xr vm_map_lock 9 747d216f0fSBruce M Simpson.Sh AUTHORS 75571dba6eSHiten PandyaThis manual page was written by 76*8a7314fcSBaptiste Daroussin.An Bruce M Simpson Aq Mt bms@spc.org . 77