00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _MALLOC_H
00021 #define _MALLOC_H 1
00022
00023 #ifdef _LIBC
00024 #include <features.h>
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #if defined(__STDC__) || defined (__cplusplus)
00046 # include <stddef.h>
00047 # define __malloc_ptr_t void *
00048 #else
00049 # undef size_t
00050 # define size_t unsigned int
00051 # undef ptrdiff_t
00052 # define ptrdiff_t int
00053 # define __malloc_ptr_t char *
00054 #endif
00055
00056 #ifdef _LIBC
00057
00058 # define __malloc_size_t size_t
00059 # define __malloc_ptrdiff_t ptrdiff_t
00060 #elif !defined __attribute_malloc__
00061 # define __attribute_malloc__
00062 #endif
00063
00064 #ifdef __GNUC__
00065
00066
00067
00068
00069
00070
00071 # ifdef __THROW
00072 # undef __THROW
00073 # endif
00074 # if defined __cplusplus && (__GNUC__ >= 3 || __GNUC_MINOR__ >= 8)
00075 # define __THROW throw ()
00076 # else
00077 # define __THROW
00078 # endif
00079 # define __MALLOC_P(args) args __THROW
00080
00081
00082 # define __MALLOC_PMT(args) args
00083
00084 #else
00085
00086 # define __THROW
00087
00088 # if (defined __STDC__ && __STDC__) || defined __cplusplus
00089
00090 # define __MALLOC_P(args) args
00091 # define __MALLOC_PMT(args) args
00092
00093 # else
00094
00095 # define __MALLOC_P(args) ()
00096 # define __MALLOC_PMT(args) ()
00097
00098 # endif
00099
00100 #endif
00101
00102 #ifndef NULL
00103 # ifdef __cplusplus
00104 # define NULL 0
00105 # else
00106 # define NULL ((__malloc_ptr_t) 0)
00107 # endif
00108 #endif
00109
00110 #ifdef __cplusplus
00111 extern "C" {
00112 #endif
00113
00114
00115 extern __malloc_ptr_t malloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
00116
00117
00118 extern __malloc_ptr_t calloc __MALLOC_P ((size_t __nmemb, size_t __size))
00119 __attribute_malloc__;
00120
00121
00122
00123 extern __malloc_ptr_t realloc __MALLOC_P ((__malloc_ptr_t __ptr,
00124 size_t __size))
00125 __attribute_malloc__;
00126
00127
00128 extern void free __MALLOC_P ((__malloc_ptr_t __ptr));
00129
00130
00131 extern void cfree __MALLOC_P ((__malloc_ptr_t __ptr));
00132
00133
00134 extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size));
00135
00136
00137 extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
00138
00139
00140
00141 extern __malloc_ptr_t pvalloc __MALLOC_P ((size_t __size))
00142 __attribute_malloc__;
00143
00144
00145
00146 extern __malloc_ptr_t (*__morecore) __MALLOC_PMT ((ptrdiff_t __size));
00147
00148
00149 extern __malloc_ptr_t __default_morecore __MALLOC_P ((ptrdiff_t __size))
00150 __attribute_malloc__;
00151
00152
00153
00154 #ifndef _STRUCT_MALLINFO
00155 struct mallinfo {
00156 int arena;
00157 int ordblks;
00158 int smblks;
00159 int hblks;
00160 int hblkhd;
00161 int usmblks;
00162 int fsmblks;
00163 int uordblks;
00164 int fordblks;
00165 int keepcost;
00166 };
00167 #endif
00168
00169
00170 extern struct mallinfo mallinfo __MALLOC_P ((void));
00171
00172
00173 #ifndef M_MXFAST
00174 # define M_MXFAST 1
00175 #endif
00176 #ifndef M_NLBLKS
00177 # define M_NLBLKS 2
00178 #endif
00179 #ifndef M_GRAIN
00180 # define M_GRAIN 3
00181 #endif
00182 #ifndef M_KEEP
00183 # define M_KEEP 4
00184 #endif
00185
00186
00187 #define M_TRIM_THRESHOLD -1
00188 #define M_TOP_PAD -2
00189 #define M_MMAP_THRESHOLD -3
00190 #define M_MMAP_MAX -4
00191 #define M_CHECK_ACTION -5
00192
00193
00194 extern int mallopt __MALLOC_P ((int __param, int __val));
00195
00196
00197
00198 extern int malloc_trim __MALLOC_P ((size_t __pad));
00199
00200
00201
00202 extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr));
00203
00204
00205 extern void malloc_stats __MALLOC_P ((void));
00206
00207
00208 extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
00209
00210
00211
00212 extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
00213
00214
00215
00216
00217 extern void (*__malloc_initialize_hook) __MALLOC_PMT ((void));
00218
00219 extern void (*__free_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
00220 const __malloc_ptr_t));
00221 extern __malloc_ptr_t (*__malloc_hook) __MALLOC_PMT ((size_t __size,
00222 const __malloc_ptr_t));
00223 extern __malloc_ptr_t (*__realloc_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
00224 size_t __size,
00225 const __malloc_ptr_t));
00226 extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __alignment,
00227 size_t __size,
00228 const __malloc_ptr_t));
00229 extern void (*__after_morecore_hook) __MALLOC_PMT ((void));
00230
00231
00232 extern void __malloc_check_init __MALLOC_P ((void));
00233
00234
00235 #ifdef __cplusplus
00236 };
00237 #endif
00238
00239 #endif