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  */
25 
26 #ifndef	_MDBMOD_UMEM_H
27 #define	_MDBMOD_UMEM_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <mdb/mdb_modapi.h>
32 #include <umem_impl.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 extern int umem_ready;
39 extern uint32_t umem_stack_depth;
40 
41 extern int umem_cache_walk_init(mdb_walk_state_t *);
42 extern int umem_cache_walk_step(mdb_walk_state_t *);
43 extern void umem_cache_walk_fini(mdb_walk_state_t *);
44 
45 extern int umem_cpu_walk_init(mdb_walk_state_t *);
46 extern int umem_cpu_walk_step(mdb_walk_state_t *);
47 extern void umem_cpu_walk_fini(mdb_walk_state_t *);
48 
49 extern int umem_cpu_cache_walk_init(mdb_walk_state_t *);
50 extern int umem_cpu_cache_walk_step(mdb_walk_state_t *);
51 
52 extern int umem_slab_walk_init(mdb_walk_state_t *);
53 extern int umem_slab_walk_partial_init(mdb_walk_state_t *);
54 extern int umem_slab_walk_step(mdb_walk_state_t *);
55 
56 extern int umem_hash_walk_init(mdb_walk_state_t *wsp);
57 extern int umem_hash_walk_step(mdb_walk_state_t *wsp);
58 extern void umem_hash_walk_fini(mdb_walk_state_t *wsp);
59 
60 extern int umem_walk_init(mdb_walk_state_t *);
61 extern int bufctl_walk_init(mdb_walk_state_t *);
62 extern int freemem_walk_init(mdb_walk_state_t *);
63 extern int freectl_walk_init(mdb_walk_state_t *);
64 
65 extern int umem_walk_step(mdb_walk_state_t *);
66 extern void umem_walk_fini(mdb_walk_state_t *);
67 
68 extern int bufctl_history_walk_init(mdb_walk_state_t *);
69 extern int bufctl_history_walk_step(mdb_walk_state_t *);
70 extern void bufctl_history_walk_fini(mdb_walk_state_t *);
71 
72 extern int allocdby_walk_init(mdb_walk_state_t *);
73 extern int allocdby_walk_step(mdb_walk_state_t *);
74 extern void allocdby_walk_fini(mdb_walk_state_t *);
75 
76 extern int freedby_walk_init(mdb_walk_state_t *);
77 extern int freedby_walk_step(mdb_walk_state_t *);
78 extern void freedby_walk_fini(mdb_walk_state_t *);
79 
80 extern int umem_log_walk_init(mdb_walk_state_t *);
81 extern int umem_log_walk_step(mdb_walk_state_t *);
82 extern void umem_log_walk_fini(mdb_walk_state_t *);
83 
84 extern int allocdby_walk_init(mdb_walk_state_t *);
85 extern int allocdby_walk_step(mdb_walk_state_t *);
86 extern void allocdby_walk_fini(mdb_walk_state_t *);
87 
88 extern int freedby_walk_init(mdb_walk_state_t *);
89 extern int freedby_walk_step(mdb_walk_state_t *);
90 extern void freedby_walk_fini(mdb_walk_state_t *);
91 
92 extern int vmem_walk_init(mdb_walk_state_t *);
93 extern int vmem_walk_step(mdb_walk_state_t *);
94 extern void vmem_walk_fini(mdb_walk_state_t *);
95 
96 extern int vmem_postfix_walk_step(mdb_walk_state_t *);
97 
98 extern int vmem_seg_walk_init(mdb_walk_state_t *);
99 extern int vmem_seg_walk_step(mdb_walk_state_t *);
100 extern void vmem_seg_walk_fini(mdb_walk_state_t *);
101 
102 extern int vmem_span_walk_init(mdb_walk_state_t *);
103 extern int vmem_alloc_walk_init(mdb_walk_state_t *);
104 extern int vmem_free_walk_init(mdb_walk_state_t *);
105 
106 extern int allocdby(uintptr_t, uint_t, int, const mdb_arg_t *);
107 extern int bufctl(uintptr_t, uint_t, int, const mdb_arg_t *);
108 extern int bufctl_audit(uintptr_t, uint_t, int, const mdb_arg_t *);
109 extern int freedby(uintptr_t, uint_t, int, const mdb_arg_t *);
110 extern int umalog(uintptr_t, uint_t, int, const mdb_arg_t *);
111 extern int umausers(uintptr_t, uint_t, int, const mdb_arg_t *);
112 extern int umem_cache(uintptr_t, uint_t, int, const mdb_arg_t *);
113 extern int umem_log(uintptr_t, uint_t, int, const mdb_arg_t *);
114 extern int umem_malloc_dist(uintptr_t, uint_t, int, const mdb_arg_t *);
115 extern int umem_malloc_info(uintptr_t, uint_t, int, const mdb_arg_t *);
116 extern int umem_status(uintptr_t, uint_t, int, const mdb_arg_t *);
117 extern int umem_verify(uintptr_t, uint_t, int, const mdb_arg_t *);
118 extern int umem_verify_alloc(uintptr_t, uint_t, int, const mdb_arg_t *);
119 extern int umem_verify_free(uintptr_t, uint_t, int, const mdb_arg_t *);
120 extern int vmem(uintptr_t, uint_t, int, const mdb_arg_t *);
121 extern int vmem_seg(uintptr_t, uint_t, int, const mdb_arg_t *);
122 extern int whatis(uintptr_t, uint_t, int, const mdb_arg_t *);
123 
124 extern void bufctl_help(void);
125 extern void umem_malloc_dist_help(void);
126 extern void umem_malloc_info_help(void);
127 extern void vmem_seg_help(void);
128 
129 /*
130  * utility functions for the rest of libumem
131  */
132 extern int umem_init(void);
133 extern int umem_get_magsize(const umem_cache_t *);
134 extern size_t umem_estimate_allocated(uintptr_t, const umem_cache_t *);
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif	/* _MDBMOD_UMEM_H */
141