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.
21 .Nd create and destroy vmem arenas
24 .Vt "typedef struct vmem vmem_t;"
25 .Vt "typedef void *(vmem_alloc_t)(vmem_t *, size_t, int);"
26 .Vt "typedef void (vmem_free_t)(vmem_t *, void *, size_t);"
27 .Vt "typedef void *(vmem_ximport_t)(vmem_t *, size_t *, size_t, int);"
30 .Fa "const char *name"
34 .Fa "vmem_alloc_t *afunc"
35 .Fa "vmem_free_t *ffunc"
37 .Fa "size_t qcache_max"
42 .Fa "const char *name"
46 .Fa "vmem_ximport_t *afunc"
47 .Fa "vmem_free_t *ffunc"
49 .Fa "size_t qcache_max"
61 A character string giving a name to the vmem
64 An address indicating the lowest possible value in the arena.
66 The size of the arena to create.
70 The granularity of the arena.
71 The amount allocated at minimum by each request.
74 A function which is called to import new spans from
78 if this arena does not import from another.
84 a function taking three parameters and returning a pointer to
89 The source arena from which we'll import.
99 argument used for the import.
107 a function taking four parameters and returning a pointer to
109 (the imported space):
112 The source arena from which we'll import.
118 The size of the import.
122 this size if that is desirable, but must never decrease it.
124 The desired alignment of the imported space.
128 argument used for the import.
131 A function which is called to return spans to
135 if this arena does not import from another.
138 a function taking three parameters and returning void:
141 The arena to which space is being returned.
149 The span being returned to the source arena.
151 The size of the span being returned to the source arena.
154 An arena from which this arena will import,
157 if this arena does not import from another.
159 Each arena offers caching of integer multiples of
165 A bitmask of flags indicating the characteristics of this arena.
167 .It Dv VMC_IDENTIFIER
168 The arena represents arbitrary integer identifiers, rather than virtual
172 A pointer to the vmem arena to be destroyed.
177 is a section of an arbitrary address space (a range of integer addresses).
178 This commonly represents virtual memory, but can in fact be an arbitrary set
182 flag set at arena creation time differentiates between these two cases.
188 arguments combine to support a hierarchical structure of arenas, each
189 importing from a single parent (the
195 functions differ in that the latter provides an interface for
197 to alter the size of the span imported from
203 These functions can be called from user or kernel context.
205 Upon successful completion the
209 functions return a pointer to a vmem arena.
212 is returned to indicate the arena could not be created.