xref: /titanic_41/usr/src/cmd/mdb/common/modules/genunix/kmem.h (revision 99ebb4ca412cb0a19d77a3899a87c055b9c30fa8)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_KMEM_H
28 #define	_KMEM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <mdb/mdb_modapi.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 extern int kmem_cache_walk_init(mdb_walk_state_t *);
39 extern int kmem_cache_walk_step(mdb_walk_state_t *);
40 extern void kmem_cache_walk_fini(mdb_walk_state_t *);
41 
42 extern int kmem_cpu_cache_walk_init(mdb_walk_state_t *);
43 extern int kmem_cpu_cache_walk_step(mdb_walk_state_t *);
44 
45 extern int kmem_slab_walk_init(mdb_walk_state_t *);
46 extern int kmem_slab_walk_partial_init(mdb_walk_state_t *);
47 extern int kmem_slab_walk_step(mdb_walk_state_t *);
48 
49 extern int kmem_hash_walk_init(mdb_walk_state_t *wsp);
50 extern int kmem_hash_walk_step(mdb_walk_state_t *wsp);
51 extern void kmem_hash_walk_fini(mdb_walk_state_t *wsp);
52 
53 extern int kmem_walk_init(mdb_walk_state_t *);
54 extern int bufctl_walk_init(mdb_walk_state_t *);
55 extern int freemem_walk_init(mdb_walk_state_t *);
56 extern int freemem_constructed_walk_init(mdb_walk_state_t *);
57 extern int freectl_walk_init(mdb_walk_state_t *);
58 extern int freectl_constructed_walk_init(mdb_walk_state_t *);
59 
60 extern int kmem_walk_step(mdb_walk_state_t *);
61 extern void kmem_walk_fini(mdb_walk_state_t *);
62 
63 extern int bufctl_history_walk_init(mdb_walk_state_t *);
64 extern int bufctl_history_walk_step(mdb_walk_state_t *);
65 extern void bufctl_history_walk_fini(mdb_walk_state_t *);
66 
67 extern int kmem_log_walk_init(mdb_walk_state_t *);
68 extern int kmem_log_walk_step(mdb_walk_state_t *);
69 extern void kmem_log_walk_fini(mdb_walk_state_t *);
70 
71 extern int allocdby_walk_init(mdb_walk_state_t *);
72 extern int allocdby_walk_step(mdb_walk_state_t *);
73 extern void allocdby_walk_fini(mdb_walk_state_t *);
74 
75 extern int freedby_walk_init(mdb_walk_state_t *);
76 extern int freedby_walk_step(mdb_walk_state_t *);
77 extern void freedby_walk_fini(mdb_walk_state_t *);
78 
79 extern int vmem_walk_init(mdb_walk_state_t *);
80 extern int vmem_walk_step(mdb_walk_state_t *);
81 extern void vmem_walk_fini(mdb_walk_state_t *);
82 
83 extern int vmem_postfix_walk_step(mdb_walk_state_t *);
84 
85 extern int vmem_seg_walk_init(mdb_walk_state_t *);
86 extern int vmem_seg_walk_step(mdb_walk_state_t *);
87 extern void vmem_seg_walk_fini(mdb_walk_state_t *);
88 
89 extern int vmem_span_walk_init(mdb_walk_state_t *);
90 extern int vmem_alloc_walk_init(mdb_walk_state_t *);
91 extern int vmem_free_walk_init(mdb_walk_state_t *);
92 
93 extern int kmem_cache(uintptr_t, uint_t, int, const mdb_arg_t *);
94 extern int allocdby(uintptr_t, uint_t, int, const mdb_arg_t *);
95 extern int freedby(uintptr_t, uint_t, int, const mdb_arg_t *);
96 extern int whatis(uintptr_t, uint_t, int, const mdb_arg_t *);
97 extern int kmem_log(uintptr_t, uint_t, int, const mdb_arg_t *);
98 extern int kmem_debug(uintptr_t, uint_t, int, const mdb_arg_t *);
99 extern int bufctl(uintptr_t, uint_t, int, const mdb_arg_t *);
100 extern int kmem_verify(uintptr_t, uint_t, int, const mdb_arg_t *);
101 extern int kmem_verify_alloc(uintptr_t, uint_t, int, const mdb_arg_t *);
102 extern int kmem_verify_free(uintptr_t, uint_t, int, const mdb_arg_t *);
103 extern int vmem(uintptr_t, uint_t, int, const mdb_arg_t *);
104 extern int vmem_seg(uintptr_t, uint_t, int, const mdb_arg_t *);
105 extern int kmalog(uintptr_t, uint_t, int, const mdb_arg_t *);
106 extern int kmausers(uintptr_t, uint_t, int, const mdb_arg_t *);
107 extern void whatis_help(void);
108 extern void bufctl_help(void);
109 extern void vmem_seg_help(void);
110 extern void kmausers_help(void);
111 
112 extern int whatthread(uintptr_t, uint_t, int, const mdb_arg_t *);
113 
114 /*
115  * utility functions for the rest of genunix
116  */
117 extern void kmem_init(void);
118 extern int kmem_get_magsize(const kmem_cache_t *);
119 extern size_t kmem_estimate_allocated(uintptr_t, const kmem_cache_t *);
120 
121 #ifdef	__cplusplus
122 }
123 #endif
124 
125 #endif	/* _KMEM_H */
126