xref: /titanic_52/usr/src/lib/libbc/inc/include/malloc.h (revision 74e20cfe817b82802b16fac8690dadcda76f54f5)
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 1989 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*      Copyright (c) 1984 AT&T */
28 /*        All Rights Reserved   */
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifndef	__malloc_h
33 #define	__malloc_h
34 
35 /*
36  *	Constants defining mallopt operations
37  */
38 #define	M_MXFAST	1	/* set size of 'small blocks' */
39 #define	M_NLBLKS	2	/* set num of small blocks in holding block */
40 #define	M_GRAIN		3	/* set rounding factor for small blocks */
41 #define	M_KEEP		4	/* (nop) retain contents of freed blocks */
42 
43 /*
44  *	malloc information structure
45  */
46 struct	mallinfo  {
47 	int arena;	/* total space in arena */
48 	int ordblks;	/* number of ordinary blocks */
49 	int smblks;	/* number of small blocks */
50 	int hblks;	/* number of holding blocks */
51 	int hblkhd;	/* space in holding block headers */
52 	int usmblks;	/* space in small blocks in use */
53 	int fsmblks;	/* space in free small blocks */
54 	int uordblks;	/* space in ordinary blocks in use */
55 	int fordblks;	/* space in free ordinary blocks */
56 	int keepcost;	/* cost of enabling keep option */
57 
58 	int mxfast;	/* max size of small blocks */
59 	int nlblks;	/* number of small blocks in a holding block */
60 	int grain;	/* small block rounding factor */
61 	int uordbytes;	/* space (including overhead) allocated in ord. blks */
62 	int allocated;	/* number of ordinary blocks allocated */
63 	int treeoverhead;	/* bytes used in maintaining the free tree */
64 };
65 
66 typedef	char *	malloc_t;
67 
68 extern	malloc_t	calloc(/* size_t nmemb, size_t size */);
69 extern	int		free(/* malloc_t ptr */);
70 extern	malloc_t	malloc(/* size_t size */);
71 extern	malloc_t	realloc(/* malloc_t ptr, size_t size */);
72 extern	int		mallopt();
73 extern	struct mallinfo mallinfo();
74 
75 #endif	/* !__malloc_h */
76