NetBSD-5.0.2/share/man/man9/vmem_alloc.9

Compare this file to the similar file:
Show the results in this format:

.\"	$NetBSD: vmem_alloc.9,v 1.3 2006/11/04 12:39:50 yamt Exp $
.\"
.\" Copyright (c)2006 YAMAMOTO Takashi,
.\" 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 AUTHOR 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 AUTHOR 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 October 22, 2006
.Dt VMEM_ALLOC 9
.Os
.\" ------------------------------------------------------------
.Sh NAME
.Nm vmem_alloc
.Nd Allocate resource from arena
.\" ------------------------------------------------------------
.Sh SYNOPSIS
.In sys/vmem.h
.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.Ft vmem_addr_t
.Fn vmem_alloc \
"vmem_t *vm" "vmem_size_t size" "vm_flag_t flags"
.\" ------------------------------------------------------------
.Sh DESCRIPTION
.Fn vmem_alloc
allocates a resource from the arena.
.Pp
.Bl -tag -width flags
.It Fa vm
The arena which we allocate from.
.It Fa size
Specify the size of the allocation.
.It Fa flags
A bitwise OR of an allocation strategy and a sleep flag.
.Pp
The allocation strategy is one of:
.Bl -tag -width VM_INSTANTFIT
.It Dv VM_BESTFIT
Prefer space efficiency.
.It Dv VM_INSTANTFIT
Prefer performance.
.El
.Pp
The sleep flag should be one of:
.Bl -tag -width VM_NOSLEEP
.It Dv VM_SLEEP
Can sleep until enough resources are available.
.It Dv VM_NOSLEEP
Don't sleep.
Immediately return
.Dv VMEM_ADDR_NULL
if there are not enough resources available.
.El
.El
.\" ------------------------------------------------------------
.Sh RETURN VALUES
On success,
.Fn vmem_alloc
returns an allocated vmem_addr_t.
Otherwise, it returns
.Dv VMEM_ADDR_NULL .
.\" ------------------------------------------------------------
.Sh SEE ALSO
.Xr intro 9 ,
.Xr vmem 9