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