xref: /illumos-gate/usr/src/cmd/mdb/common/modules/genunix/kmem.h (revision cf74e62b28857cc7cf88dd0a34d34df9a7e26fe8)
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 2007 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 extern int kmem_cache_walk_step(mdb_walk_state_t *);
39 extern void kmem_cache_walk_fini(mdb_walk_state_t *);
40 
41 extern int kmem_cpu_cache_walk_init(mdb_walk_state_t *);
42 extern int kmem_cpu_cache_walk_step(mdb_walk_state_t *);
43 
44 extern int kmem_slab_walk_init(mdb_walk_state_t *);
45 extern int kmem_slab_walk_partial_init(mdb_walk_state_t *);
46 extern int kmem_slab_walk_step(mdb_walk_state_t *);
47 
48 extern int kmem_hash_walk_init(mdb_walk_state_t *wsp);
49 extern int kmem_hash_walk_step(mdb_walk_state_t *wsp);
50 extern void kmem_hash_walk_fini(mdb_walk_state_t *wsp);
51 
52 extern int kmem_walk_init(mdb_walk_state_t *);
53 extern int bufctl_walk_init(mdb_walk_state_t *);
54 extern int freemem_walk_init(mdb_walk_state_t *);
55 extern int freemem_constructed_walk_init(mdb_walk_state_t *);
56 extern int freectl_walk_init(mdb_walk_state_t *);
57 extern int freectl_constructed_walk_init(mdb_walk_state_t *);
58 
59 extern int kmem_walk_step(mdb_walk_state_t *);
60 extern void kmem_walk_fini(mdb_walk_state_t *);
61 
62 extern int bufctl_history_walk_init(mdb_walk_state_t *);
63 extern int bufctl_history_walk_step(mdb_walk_state_t *);
64 extern void bufctl_history_walk_fini(mdb_walk_state_t *);
65 
66 extern int kmem_log_walk_init(mdb_walk_state_t *);
67 extern int kmem_log_walk_step(mdb_walk_state_t *);
68 extern void kmem_log_walk_fini(mdb_walk_state_t *);
69 
70 extern int allocdby_walk_init(mdb_walk_state_t *);
71 extern int allocdby_walk_step(mdb_walk_state_t *);
72 extern void allocdby_walk_fini(mdb_walk_state_t *);
73 
74 extern int freedby_walk_init(mdb_walk_state_t *);
75 extern int freedby_walk_step(mdb_walk_state_t *);
76 extern void freedby_walk_fini(mdb_walk_state_t *);
77 
78 extern int vmem_walk_init(mdb_walk_state_t *);
79 extern int vmem_walk_step(mdb_walk_state_t *);
80 extern void vmem_walk_fini(mdb_walk_state_t *);
81 
82 extern int vmem_postfix_walk_step(mdb_walk_state_t *);
83 
84 extern int vmem_seg_walk_init(mdb_walk_state_t *);
85 extern int vmem_seg_walk_step(mdb_walk_state_t *);
86 extern void vmem_seg_walk_fini(mdb_walk_state_t *);
87 
88 extern int vmem_span_walk_init(mdb_walk_state_t *);
89 extern int vmem_alloc_walk_init(mdb_walk_state_t *);
90 extern int vmem_free_walk_init(mdb_walk_state_t *);
91 
92 extern int kmem_cache(uintptr_t, uint_t, int, const mdb_arg_t *);
93 extern int kmem_slabs(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 extern void kmem_slabs_help(void);
112 
113 extern int whatthread(uintptr_t, uint_t, int, const mdb_arg_t *);
114 
115 /*
116  * utility functions for the rest of genunix
117  */
118 extern void kmem_init(void);
119 extern int kmem_get_magsize(const kmem_cache_t *);
120 extern size_t kmem_estimate_allocated(uintptr_t, const kmem_cache_t *);
121 
122 #ifdef	__cplusplus
123 }
124 #endif
125 
126 #endif	/* _KMEM_H */
127