1 /* malloc.h -- header file for memory routines. */
3 #ifndef _INCLUDE_MALLOC_H_
4 #define _INCLUDE_MALLOC_H_
12 /* include any machine-specific extensions */
13 #include <machine/malloc.h>
19 /* This version of struct mallinfo must match the one in
20 libc/stdlib/mallocr.c. */
23 int arena
; /* total space allocated from system */
24 int ordblks
; /* number of non-inuse chunks */
25 int smblks
; /* unused -- always zero */
26 int hblks
; /* number of mmapped regions */
27 int hblkhd
; /* total space in mmapped regions */
28 int usmblks
; /* unused -- always zero */
29 int fsmblks
; /* unused -- always zero */
30 int uordblks
; /* total allocated space */
31 int fordblks
; /* total non-inuse space */
32 int keepcost
; /* top-most, releasable (via malloc_trim) space */
37 extern _PTR malloc
_PARAMS ((size_t));
40 #define _malloc_r(r, s) malloc (s)
42 extern _PTR _malloc_r
_PARAMS ((struct _reent
*, size_t));
45 extern _VOID free
_PARAMS ((_PTR
));
48 #define _free_r(r, p) free (p)
50 extern _VOID _free_r
_PARAMS ((struct _reent
*, _PTR
));
53 extern _PTR realloc
_PARAMS ((_PTR
, size_t));
56 #define _realloc_r(r, p, s) realloc (p, s)
58 extern _PTR _realloc_r
_PARAMS ((struct _reent
*, _PTR
, size_t));
61 extern _PTR calloc
_PARAMS ((size_t, size_t));
64 #define _calloc_r(r, s1, s2) calloc (s1, s2);
66 extern _PTR _calloc_r
_PARAMS ((struct _reent
*, size_t, size_t));
69 extern _PTR memalign
_PARAMS ((size_t, size_t));
72 #define _memalign_r(r, s1, s2) memalign (s1, s2);
74 extern _PTR _memalign_r
_PARAMS ((struct _reent
*, size_t, size_t));
77 extern struct mallinfo mallinfo
_PARAMS ((void));
80 #define _mallinfo_r(r) mallinfo ()
82 extern struct mallinfo _mallinfo_r
_PARAMS ((struct _reent
*));
85 extern void malloc_stats
_PARAMS ((void));
87 #undef _malloc_stats_r
88 #define _malloc_stats_r(r) malloc_stats ()
90 extern void _malloc_stats_r
_PARAMS ((struct _reent
*));
93 extern int mallopt
_PARAMS ((int, int));
96 #define _mallopt_r(i1, i2) mallopt (i1, i2)
98 extern int _mallopt_r
_PARAMS ((struct _reent
*, int, int));
101 extern size_t malloc_usable_size
_PARAMS ((_PTR
));
103 #undef _malloc_usable_size_r
104 #define _malloc_usable_size_r(r, p) malloc_usable_size (p)
106 extern size_t _malloc_usable_size_r
_PARAMS ((struct _reent
*, _PTR
));
109 /* These aren't too useful on an embedded system, but we define them
112 extern _PTR valloc
_PARAMS ((size_t));
115 #define _valloc_r(r, s) valloc (s)
117 extern _PTR _valloc_r
_PARAMS ((struct _reent
*, size_t));
120 extern _PTR pvalloc
_PARAMS ((size_t));
123 #define _pvalloc_r(r, s) pvalloc (s)
125 extern _PTR _pvalloc_r
_PARAMS ((struct _reent
*, size_t));
128 extern int malloc_trim
_PARAMS ((size_t));
130 #undef _malloc_trim_r
131 #define _malloc_trim_r(r, s) malloc_trim (s)
133 extern int _malloc_trim_r
_PARAMS ((struct _reent
*, size_t));
136 /* A compatibility routine for an earlier version of the allocator. */
138 extern _VOID mstats
_PARAMS ((char *));
141 #define _mstats_r(r, p) mstats (p)
143 extern _VOID _mstats_r
_PARAMS ((struct _reent
*, char *));
146 /* SVID2/XPG mallopt options */
148 #define M_MXFAST 1 /* UNUSED in this malloc */
149 #define M_NLBLKS 2 /* UNUSED in this malloc */
150 #define M_GRAIN 3 /* UNUSED in this malloc */
151 #define M_KEEP 4 /* UNUSED in this malloc */
153 /* mallopt options that actually do something */
155 #define M_TRIM_THRESHOLD -1
157 #define M_MMAP_THRESHOLD -3
158 #define M_MMAP_MAX -4
161 /* Some systems provide this, so do too for compatibility. */
162 extern void cfree
_PARAMS ((_PTR
));
163 #endif /* __CYGWIN__ */
169 #endif /* _INCLUDE_MALLOC_H_ */