2 * (c) Copyright 1990 Conor P. Cahill (uunet!virtech!cpcahil).
3 * You may copy, distribute, and use this software as long as this
4 * copyright statement is not removed.
7 * $Id: malloc.h,v 1.2 2006-07-25 10:08:50 rt Exp $
11 struct mlist
* next
; /* next entry in chain */
12 struct mlist
* prev
; /* prev entry in chain */
13 int flag
; /* inuse flag */
14 unsigned int r_size
; /* requested size */
17 unsigned int size
; /* actual size */
18 double unused_just_for_alignment
;
23 #define M_SIZE ((int)(char *)((struct mlist *)0)->data)
27 #define M_MAGIC 0x03156100
29 #define M_BLOCKSIZE (1024*8)
32 #define M_FREE_FILL '\02'
34 #define M_ROUNDUP(size) {\
35 if( size & (M_RND-1) ) \
43 * Malloc warning/fatal error handler defines...
45 #define M_HANDLE_DUMP 0x80 /* 128 */
46 #define M_HANDLE_IGNORE 0
47 #define M_HANDLE_ABORT 1
48 #define M_HANDLE_EXIT 2
49 #define M_HANDLE_CORE 3
52 * Mallopt commands and defaults
55 #define MALLOC_WARN 1 /* set malloc warning handling */
56 #define MALLOC_FATAL 2 /* set malloc fatal handling */
57 #define MALLOC_ERRFILE 3 /* specify malloc error file */
58 #define MALLOC_CKCHAIN 4 /* turn on chain checking */
66 * Malloc warning/fatal error codes
69 #define M_CODE_CHAIN_BROKE 1 /* malloc chain is broken */
70 #define M_CODE_NO_END 2 /* chain end != endptr */
71 #define M_CODE_BAD_PTR 3 /* pointer not in malloc area */
72 #define M_CODE_BAD_MAGIC 4 /* bad magic number in header */
73 #define M_CODE_BAD_CONNECT 5 /* chain poingers corrupt */
74 #define M_CODE_OVERRUN 6 /* data overrun in malloc seg */
75 #define M_CODE_REUSE 7 /* reuse of freed area */
76 #define M_CODE_NOT_INUSE 8 /* pointer is not in use */
77 #define M_CODE_NOMORE_MEM 9 /* no more memory available */
78 #define M_CODE_OUTOF_BOUNDS 10 /* gone beyound bounds */
80 void malloc_warning();
82 void malloc_check_data();
83 void malloc_check_str();