Search
lxdream.org :: lxdream/test/include/malloc.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/include/malloc.h
changeset 185:6755a04c447f
author nkeynes
date Fri Dec 29 00:24:43 2006 +0000 (17 years ago)
permissions -rw-r--r--
last change Limit number of sectors read at once (linux driver seems to throw a hissy
fit if you request too many at a time)
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/include/malloc.h Fri Dec 29 00:24:43 2006 +0000
1.3 @@ -0,0 +1,97 @@
1.4 +/* malloc.h -- header file for memory routines. */
1.5 +
1.6 +#ifndef _INCLUDE_MALLOC_H_
1.7 +#define _INCLUDE_MALLOC_H_
1.8 +
1.9 +#include <_ansi.h>
1.10 +#include <sys/reent.h>
1.11 +
1.12 +#define __need_size_t
1.13 +#include <stddef.h>
1.14 +
1.15 +#ifdef __cplusplus
1.16 +extern "C" {
1.17 +#endif
1.18 +
1.19 +/* This version of struct mallinfo must match the one in
1.20 + libc/stdlib/mallocr.c. */
1.21 +
1.22 +struct mallinfo {
1.23 + int arena; /* total space allocated from system */
1.24 + int ordblks; /* number of non-inuse chunks */
1.25 + int smblks; /* unused -- always zero */
1.26 + int hblks; /* number of mmapped regions */
1.27 + int hblkhd; /* total space in mmapped regions */
1.28 + int usmblks; /* unused -- always zero */
1.29 + int fsmblks; /* unused -- always zero */
1.30 + int uordblks; /* total allocated space */
1.31 + int fordblks; /* total non-inuse space */
1.32 + int keepcost; /* top-most, releasable (via malloc_trim) space */
1.33 +};
1.34 +
1.35 +/* The routines. */
1.36 +
1.37 +extern _PTR malloc _PARAMS ((size_t));
1.38 +extern _PTR _malloc_r _PARAMS ((struct _reent *, size_t));
1.39 +
1.40 +extern _VOID free _PARAMS ((_PTR));
1.41 +extern _VOID _free_r _PARAMS ((struct _reent *, _PTR));
1.42 +
1.43 +extern _PTR realloc _PARAMS ((_PTR, size_t));
1.44 +extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t));
1.45 +
1.46 +extern _PTR calloc _PARAMS ((size_t, size_t));
1.47 +extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t));
1.48 +
1.49 +extern _PTR memalign _PARAMS ((size_t, size_t));
1.50 +extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t));
1.51 +
1.52 +extern struct mallinfo mallinfo _PARAMS ((void));
1.53 +extern struct mallinfo _mallinfo_r _PARAMS ((struct _reent *));
1.54 +
1.55 +extern void malloc_stats _PARAMS ((void));
1.56 +extern void _malloc_stats_r _PARAMS ((struct _reent *));
1.57 +
1.58 +extern int mallopt _PARAMS ((int, int));
1.59 +extern int _mallopt_r _PARAMS ((struct _reent *, int, int));
1.60 +
1.61 +extern size_t malloc_usable_size _PARAMS ((_PTR));
1.62 +extern size_t _malloc_usable_size_r _PARAMS ((struct _reent *, _PTR));
1.63 +
1.64 +/* These aren't too useful on an embedded system, but we define them
1.65 + anyhow. */
1.66 +
1.67 +extern _PTR valloc _PARAMS ((size_t));
1.68 +extern _PTR _valloc_r _PARAMS ((struct _reent *, size_t));
1.69 +
1.70 +extern _PTR pvalloc _PARAMS ((size_t));
1.71 +extern _PTR _pvalloc_r _PARAMS ((struct _reent *, size_t));
1.72 +
1.73 +extern int malloc_trim _PARAMS ((size_t));
1.74 +extern int _malloc_trim_r _PARAMS ((struct _reent *, size_t));
1.75 +
1.76 +/* Some systems provide this, so do too for compatibility. */
1.77 +
1.78 +extern void cfree _PARAMS ((_PTR));
1.79 +
1.80 +/* A compatibility routine for an earlier version of the allocator. */
1.81 +
1.82 +extern _VOID mstats _PARAMS ((char *));
1.83 +extern _VOID _mstats_r _PARAMS ((struct _reent *, char *));
1.84 +
1.85 +#ifdef __CYGWIN32__
1.86 +
1.87 +/* Cygwin32 needs to be able to copy all the malloc information from
1.88 + the parent to the child. However, cygwin32 does not normally copy
1.89 + any data in the DLL data section. This routine handles copying
1.90 + that information. */
1.91 +
1.92 +extern int __malloc_copy _PARAMS ((int (*) (void *, void *, void *, int),
1.93 + void *, int));
1.94 +#endif /* __CYGWIN32 */
1.95 +
1.96 +#ifdef __cplusplus
1.97 +}
1.98 +#endif
1.99 +
1.100 +#endif /* _INCLUDE_MALLOC_H_ */
.