1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 * Copyright 2012 Joyent, Inc. All rights reserved. 25 */ 26 27 #ifndef _VMEM_BASE_H 28 #define _VMEM_BASE_H 29 30 #include <sys/vmem.h> 31 #include <umem.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #include "misc.h" 38 39 extern void vmem_startup(void); 40 extern vmem_t *vmem_init(const char *parent_name, size_t parent_quantum, 41 vmem_alloc_t *parent_alloc, vmem_free_t *parent_free, 42 const char *heap_name, 43 void *heap_start, size_t heap_size, size_t heap_quantum, 44 vmem_alloc_t *heap_alloc, vmem_free_t *heap_free); 45 46 extern void *_vmem_extend_alloc(vmem_t *vmp, void *vaddr, size_t size, 47 size_t alloc, int vmflag); 48 49 extern vmem_t *vmem_heap_arena(vmem_alloc_t **, vmem_free_t **); 50 extern void vmem_heap_init(void); 51 52 extern vmem_t *vmem_sbrk_arena(vmem_alloc_t **, vmem_free_t **); 53 extern vmem_t *vmem_mmap_arena(vmem_alloc_t **, vmem_free_t **); 54 extern vmem_t *vmem_stand_arena(vmem_alloc_t **, vmem_free_t **); 55 56 extern void vmem_update(void *); 57 extern void vmem_reap(void); /* vmem_populate()-safe reap */ 58 59 extern size_t pagesize; 60 extern size_t vmem_sbrk_pagesize; 61 extern size_t vmem_sbrk_minalloc; 62 63 extern uint_t vmem_backend; 64 #define VMEM_BACKEND_SBRK 0x0000001 65 #define VMEM_BACKEND_MMAP 0x0000002 66 #define VMEM_BACKEND_STAND 0x0000003 67 68 extern uint_t vmem_allocator; 69 70 extern vmem_t *vmem_heap; 71 extern vmem_alloc_t *vmem_heap_alloc; 72 extern vmem_free_t *vmem_heap_free; 73 74 extern void vmem_lockup(void); 75 extern void vmem_release(void); 76 77 extern void vmem_sbrk_lockup(void); 78 extern void vmem_sbrk_release(void); 79 80 extern void vmem_no_debug(void); 81 82 #ifdef __cplusplus 83 } 84 #endif 85 86 #endif /* _VMEM_BASE_H */ 87