Search
lxdream.org :: lxdream/test/include/malloc.h
lxdream 0.9.1
released Jun 29
Download Now
filename test/include/malloc.h
changeset 185:6755a04c447f
author nkeynes
date Tue Jan 15 20:50:23 2008 +0000 (16 years ago)
permissions -rw-r--r--
last change Merged lxdream-mmu r570:596 to trunk
view annotate diff log raw
     1 /* malloc.h -- header file for memory routines.  */
     3 #ifndef _INCLUDE_MALLOC_H_
     4 #define _INCLUDE_MALLOC_H_
     6 #include <_ansi.h>
     7 #include <sys/reent.h>
     9 #define __need_size_t
    10 #include <stddef.h>
    12 #ifdef __cplusplus
    13 extern "C" {
    14 #endif
    16 /* This version of struct mallinfo must match the one in
    17    libc/stdlib/mallocr.c.  */
    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 };	
    32 /* The routines.  */
    34 extern _PTR malloc _PARAMS ((size_t));
    35 extern _PTR _malloc_r _PARAMS ((struct _reent *, size_t));
    37 extern _VOID free _PARAMS ((_PTR));
    38 extern _VOID _free_r _PARAMS ((struct _reent *, _PTR));
    40 extern _PTR realloc _PARAMS ((_PTR, size_t));
    41 extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t));
    43 extern _PTR calloc _PARAMS ((size_t, size_t));
    44 extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t));
    46 extern _PTR memalign _PARAMS ((size_t, size_t));
    47 extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t));
    49 extern struct mallinfo mallinfo _PARAMS ((void));
    50 extern struct mallinfo _mallinfo_r _PARAMS ((struct _reent *));
    52 extern void malloc_stats _PARAMS ((void));
    53 extern void _malloc_stats_r _PARAMS ((struct _reent *));
    55 extern int mallopt _PARAMS ((int, int));
    56 extern int _mallopt_r _PARAMS ((struct _reent *, int, int));
    58 extern size_t malloc_usable_size _PARAMS ((_PTR));
    59 extern size_t _malloc_usable_size_r _PARAMS ((struct _reent *, _PTR));
    61 /* These aren't too useful on an embedded system, but we define them
    62    anyhow.  */
    64 extern _PTR valloc _PARAMS ((size_t));
    65 extern _PTR _valloc_r _PARAMS ((struct _reent *, size_t));
    67 extern _PTR pvalloc _PARAMS ((size_t));
    68 extern _PTR _pvalloc_r _PARAMS ((struct _reent *, size_t));
    70 extern int malloc_trim _PARAMS ((size_t));
    71 extern int _malloc_trim_r _PARAMS ((struct _reent *, size_t));
    73 /* Some systems provide this, so do too for compatibility.  */
    75 extern void cfree _PARAMS ((_PTR));
    77 /* A compatibility routine for an earlier version of the allocator.  */
    79 extern _VOID mstats _PARAMS ((char *));
    80 extern _VOID _mstats_r _PARAMS ((struct _reent *, char *));
    82 #ifdef __CYGWIN32__
    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.  */
    89 extern int __malloc_copy _PARAMS ((int (*) (void *, void *, void *, int),
    90 				   void *, int));
    91 #endif /* __CYGWIN32 */
    93 #ifdef __cplusplus
    94 }
    95 #endif
    97 #endif /* _INCLUDE_MALLOC_H_ */
.