2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2017, Richard Lowe.
22 .Nd allocate and free segments from a vmem arena
35 .Fa "size_t align_arg"
59 The vmem arena from which to allocate or free.
61 The size of the segment to allocate or free.
63 A bitmask of flags controlling the behaviour of the allocation.
64 There are two meaningful groups of flags.
68 must be specified, and indicate whether the allocation may block.
71 allocation can never fail but may block indefinitely.
73 The allocation policy may be specified by one of the following flags:
76 Take the segment from the smallest free segment that could satisfy this
79 Take the segment from the first free segment found that could satisfy this
82 Take the segment from the segment after the one previously allocated.
84 provides sequential behaviour useful when allocating identifiers from a
88 May be specified in combination with
91 or the default policy to indicate that the higher addresses should be
95 The default (unnamed) allocation policy is
99 in guaranteed constant time.
101 The minimum alignment of the allocation.
102 If 0, the allocated segment will be aligned as the arena's quantum.
104 The allocated segment must be
106 bytes from the alignment boundary.
108 The allocated segment may not straddle a
112 The minimum address at which the segment may be allocated.
114 The maximum address which may be included in the segment.
116 The address of the segment which
127 functions allocate a segment of
129 length from the vmem arena
134 argument controls the behaviour of the allocation, as described in
137 For allocations with complex requirements, such as those used for DMA
139 takes additional arguments allowing those requirements to be expressed.
141 Segments allocated with
143 must always be freed with
145 since these allocations are uncached.
147 This function can be called from either user or kernel context.
150 flag is specified, it may also be called from interrupt context.
152 Upon successful completion the
156 functions return a pointer to the beginning of the allocated segment.
159 arena, the address of this pointer is the meaningful component, not the value
167 flag is specified, these functions can never fail (but may block forever).
170 .Xr vmem_contains 9F ,