xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_umem.h (revision 258e8624229ac7ff3af9890752a92cd251b83825)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_UMEM_H
28 #define	_MDB_UMEM_H
29 
30 #include <sys/types.h>
31 #include <limits.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #ifdef _MDB
38 
39 #define	UMEM_FREE_PATTERN		0xdefacedd
40 #define	UMEM_UNINITIALIZED_PATTERN	0xbeefbabe
41 
42 typedef struct mdb_mblk mdb_mblk_t;
43 
44 /* Aligned allocation/frees are not available through the module API */
45 extern void *mdb_alloc_align(size_t, size_t, uint_t);
46 extern void mdb_free_align(void *, size_t);
47 
48 extern void mdb_recycle(mdb_mblk_t **);
49 
50 /*
51  * These values represent an attempt to help constrain dmods that have bugs and
52  * have accidentally underflowed their size arguments. They represent
53  * allocations that are impossible.
54  */
55 #if	defined(_ILP32)
56 #define	MDB_ALLOC_MAX	INT32_MAX
57 #elif	defined(_LP64)
58 #define	MDB_ALLOC_MAX	INT64_MAX
59 #else
60 #error	"Unknown data model"
61 #endif
62 
63 
64 #endif /* _MDB */
65 
66 #ifdef	__cplusplus
67 }
68 #endif
69 
70 #endif	/* _MDB_UMEM_H */
71