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 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _KMEM_H 27 #define _KMEM_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <mdb/mdb_modapi.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 extern int kmem_cache_walk_init(mdb_walk_state_t *); 38 39 extern int kmem_cpu_cache_walk_init(mdb_walk_state_t *); 40 extern int kmem_cpu_cache_walk_step(mdb_walk_state_t *); 41 42 extern int kmem_slab_walk_init(mdb_walk_state_t *); 43 extern int kmem_slab_walk_partial_init(mdb_walk_state_t *); 44 45 extern int kmem_hash_walk_init(mdb_walk_state_t *wsp); 46 extern int kmem_hash_walk_step(mdb_walk_state_t *wsp); 47 extern void kmem_hash_walk_fini(mdb_walk_state_t *wsp); 48 49 extern int kmem_walk_init(mdb_walk_state_t *); 50 extern int bufctl_walk_init(mdb_walk_state_t *); 51 extern int freemem_walk_init(mdb_walk_state_t *); 52 extern int freemem_constructed_walk_init(mdb_walk_state_t *); 53 extern int freectl_walk_init(mdb_walk_state_t *); 54 extern int freectl_constructed_walk_init(mdb_walk_state_t *); 55 56 extern int kmem_walk_step(mdb_walk_state_t *); 57 extern void kmem_walk_fini(mdb_walk_state_t *); 58 59 extern int bufctl_history_walk_init(mdb_walk_state_t *); 60 extern int bufctl_history_walk_step(mdb_walk_state_t *); 61 extern void bufctl_history_walk_fini(mdb_walk_state_t *); 62 63 extern int kmem_log_walk_init(mdb_walk_state_t *); 64 extern int kmem_log_walk_step(mdb_walk_state_t *); 65 extern void kmem_log_walk_fini(mdb_walk_state_t *); 66 67 extern int allocdby_walk_init(mdb_walk_state_t *); 68 extern int allocdby_walk_step(mdb_walk_state_t *); 69 extern void allocdby_walk_fini(mdb_walk_state_t *); 70 71 extern int freedby_walk_init(mdb_walk_state_t *); 72 extern int freedby_walk_step(mdb_walk_state_t *); 73 extern void freedby_walk_fini(mdb_walk_state_t *); 74 75 extern int vmem_walk_init(mdb_walk_state_t *); 76 extern int vmem_walk_step(mdb_walk_state_t *); 77 extern void vmem_walk_fini(mdb_walk_state_t *); 78 79 extern int vmem_postfix_walk_step(mdb_walk_state_t *); 80 81 extern int vmem_seg_walk_init(mdb_walk_state_t *); 82 extern int vmem_seg_walk_step(mdb_walk_state_t *); 83 extern void vmem_seg_walk_fini(mdb_walk_state_t *); 84 85 extern int vmem_span_walk_init(mdb_walk_state_t *); 86 extern int vmem_alloc_walk_init(mdb_walk_state_t *); 87 extern int vmem_free_walk_init(mdb_walk_state_t *); 88 89 extern int kmem_cache(uintptr_t, uint_t, int, const mdb_arg_t *); 90 extern int kmem_slabs(uintptr_t, uint_t, int, const mdb_arg_t *); 91 extern int allocdby(uintptr_t, uint_t, int, const mdb_arg_t *); 92 extern int freedby(uintptr_t, uint_t, int, const mdb_arg_t *); 93 extern int whatis(uintptr_t, uint_t, int, const mdb_arg_t *); 94 extern int kmem_log(uintptr_t, uint_t, int, const mdb_arg_t *); 95 extern int kmem_debug(uintptr_t, uint_t, int, const mdb_arg_t *); 96 extern int bufctl(uintptr_t, uint_t, int, const mdb_arg_t *); 97 extern int kmem_verify(uintptr_t, uint_t, int, const mdb_arg_t *); 98 extern int kmem_verify_alloc(uintptr_t, uint_t, int, const mdb_arg_t *); 99 extern int kmem_verify_free(uintptr_t, uint_t, int, const mdb_arg_t *); 100 extern int vmem(uintptr_t, uint_t, int, const mdb_arg_t *); 101 extern int vmem_seg(uintptr_t, uint_t, int, const mdb_arg_t *); 102 extern int kmalog(uintptr_t, uint_t, int, const mdb_arg_t *); 103 extern int kmausers(uintptr_t, uint_t, int, const mdb_arg_t *); 104 extern void kmem_cache_help(void); 105 extern void kmem_slabs_help(void); 106 extern void whatis_help(void); 107 extern void bufctl_help(void); 108 extern void vmem_seg_help(void); 109 extern void kmausers_help(void); 110 111 extern int whatthread(uintptr_t, uint_t, int, const mdb_arg_t *); 112 113 /* 114 * utility functions for the rest of genunix 115 */ 116 extern void kmem_init(void); 117 extern int kmem_get_magsize(const kmem_cache_t *); 118 extern size_t kmem_estimate_allocated(uintptr_t, const kmem_cache_t *); 119 120 #ifdef __cplusplus 121 } 122 #endif 123 124 #endif /* _KMEM_H */ 125