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