1 |
39 |
lampret |
/* malloc.h -- header file for memory routines. */
|
2 |
|
|
|
3 |
|
|
#ifndef _INCLUDE_MALLOC_H_
|
4 |
|
|
#define _INCLUDE_MALLOC_H_
|
5 |
|
|
|
6 |
|
|
#include <_ansi.h>
|
7 |
|
|
#include <sys/reent.h>
|
8 |
|
|
|
9 |
|
|
#define __need_size_t
|
10 |
|
|
#include <stddef.h>
|
11 |
|
|
|
12 |
|
|
#ifdef __cplusplus
|
13 |
|
|
extern "C" {
|
14 |
|
|
#endif
|
15 |
|
|
|
16 |
|
|
/* This version of struct mallinfo must match the one in
|
17 |
|
|
libc/stdlib/mallocr.c. */
|
18 |
|
|
|
19 |
|
|
struct mallinfo {
|
20 |
|
|
int arena; /* total space allocated from system */
|
21 |
|
|
int ordblks; /* number of non-inuse chunks */
|
22 |
|
|
int smblks; /* unused -- always zero */
|
23 |
|
|
int hblks; /* number of mmapped regions */
|
24 |
|
|
int hblkhd; /* total space in mmapped regions */
|
25 |
|
|
int usmblks; /* unused -- always zero */
|
26 |
|
|
int fsmblks; /* unused -- always zero */
|
27 |
|
|
int uordblks; /* total allocated space */
|
28 |
|
|
int fordblks; /* total non-inuse space */
|
29 |
|
|
int keepcost; /* top-most, releasable (via malloc_trim) space */
|
30 |
|
|
};
|
31 |
|
|
|
32 |
|
|
/* The routines. */
|
33 |
|
|
|
34 |
|
|
extern _PTR malloc _PARAMS ((size_t));
|
35 |
|
|
extern _PTR _malloc_r _PARAMS ((struct _reent *, size_t));
|
36 |
|
|
|
37 |
|
|
extern _VOID free _PARAMS ((_PTR));
|
38 |
|
|
extern _VOID _free_r _PARAMS ((struct _reent *, _PTR));
|
39 |
|
|
|
40 |
|
|
extern _PTR realloc _PARAMS ((_PTR, size_t));
|
41 |
|
|
extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t));
|
42 |
|
|
|
43 |
|
|
extern _PTR calloc _PARAMS ((size_t, size_t));
|
44 |
|
|
extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t));
|
45 |
|
|
|
46 |
|
|
extern _PTR memalign _PARAMS ((size_t, size_t));
|
47 |
|
|
extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t));
|
48 |
|
|
|
49 |
|
|
extern struct mallinfo mallinfo _PARAMS ((void));
|
50 |
|
|
extern struct mallinfo _mallinfo_r _PARAMS ((struct _reent *));
|
51 |
|
|
|
52 |
|
|
extern void malloc_stats _PARAMS ((void));
|
53 |
|
|
extern void _malloc_stats_r _PARAMS ((struct _reent *));
|
54 |
|
|
|
55 |
|
|
extern int mallopt _PARAMS ((int, int));
|
56 |
|
|
extern int _mallopt_r _PARAMS ((struct _reent *, int, int));
|
57 |
|
|
|
58 |
|
|
extern size_t malloc_usable_size _PARAMS ((_PTR));
|
59 |
|
|
extern size_t _malloc_usable_size_r _PARAMS ((struct _reent *, _PTR));
|
60 |
|
|
|
61 |
|
|
/* These aren't too useful on an embedded system, but we define them
|
62 |
|
|
anyhow. */
|
63 |
|
|
|
64 |
|
|
extern _PTR valloc _PARAMS ((size_t));
|
65 |
|
|
extern _PTR _valloc_r _PARAMS ((struct _reent *, size_t));
|
66 |
|
|
|
67 |
|
|
extern _PTR pvalloc _PARAMS ((size_t));
|
68 |
|
|
extern _PTR _pvalloc_r _PARAMS ((struct _reent *, size_t));
|
69 |
|
|
|
70 |
|
|
extern int malloc_trim _PARAMS ((size_t));
|
71 |
|
|
extern int _malloc_trim_r _PARAMS ((struct _reent *, size_t));
|
72 |
|
|
|
73 |
|
|
/* Some systems provide this, so do too for compatibility. */
|
74 |
|
|
|
75 |
|
|
extern void cfree _PARAMS ((_PTR));
|
76 |
|
|
|
77 |
|
|
/* A compatibility routine for an earlier version of the allocator. */
|
78 |
|
|
|
79 |
|
|
extern _VOID mstats _PARAMS ((char *));
|
80 |
|
|
extern _VOID _mstats_r _PARAMS ((struct _reent *, char *));
|
81 |
|
|
|
82 |
|
|
#ifdef __CYGWIN32__
|
83 |
|
|
|
84 |
|
|
/* Cygwin32 needs to be able to copy all the malloc information from
|
85 |
|
|
the parent to the child. However, cygwin32 does not normally copy
|
86 |
|
|
any data in the DLL data section. This routine handles copying
|
87 |
|
|
that information. */
|
88 |
|
|
|
89 |
|
|
extern int __malloc_copy _PARAMS ((int (*) (void *, void *, void *, int),
|
90 |
|
|
void *, int));
|
91 |
|
|
#endif /* __CYGWIN32 */
|
92 |
|
|
|
93 |
|
|
#ifdef __cplusplus
|
94 |
|
|
}
|
95 |
|
|
#endif
|
96 |
|
|
|
97 |
|
|
#endif /* _INCLUDE_MALLOC_H_ */
|