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