/* @(#) $Revision: ../hdr/malloc.h@@/main/r11ros/cup_ros-cpe/cup_libc-ros-cpe/3 $ */       
#ifndef _MALLOC_INCLUDED
#define _MALLOC_INCLUDED /* allows multiple inclusion */

#ifndef _SYS_STDSYMS_INCLUDED
#  include <sys/stdsyms.h>
#endif /* _SYS_STDSYMS_INCLUDED */

#ifdef _NAMESPACE_STD
#define _NAMESPACE_STD_START namespace std {
#define _NAMESPACE_STD_END }
#define __size_t std::size_t
#define __time_t std::time_t
#define __FILE std::FILE
#define __wint_t std::wint_t
#define __struct_tm std::tm
#define __va__list std::va_list
#else
#define _NAMESPACE_STD_START
#define _NAMESPACE_STD_END
#define __size_t size_t
#define __time_t time_t
#define __FILE FILE
#define __wint_t wint_t
#define __struct_tm struct tm
#define __va__list va_list
#endif

#include <sys/types.h> /* for size_t type def */

#ifdef __cplusplus
extern "C" {
#endif

/*
	Constants defining mallopt operations
*/
#define M_MXFAST	1	/* set size of blocks to be fast */
#define M_NLBLKS	2	/* set number of block in a holding block */
#define M_GRAIN		3	/* set number of sizes mapped to one, for
				   small blocks */
#define M_KEEP		4	/* retain contents of block after a free until
				   another allocation */
#define M_BLOCK		5	/* enable signal blocking in all malloc
				   related routines */
#define M_UBLOCK	6	/* disable signal blocking set by M_BLOCK */
#if !defined(__LP64__) && !defined(__IA64__)
#define M_ENABLE_MMAP   7
#endif /* !defined(__LP64__) && !defined(__IA64__) */

#ifndef _STRUCT_MALLINFO
#  define _STRUCT_MALLINFO

   /* structure filled by */
   struct mallinfo  {
	int32_t arena;		/* total number of bytes in arena */
	int32_t ordblks;	/* number of ordinary blocks */
	int32_t smblks;		/* number of small blocks */
	int32_t hblks;		/* number of holding blocks */
	int32_t hblkhd;		/* number of bytes in holding block headers */
	int32_t usmblks;	/* number of bytes in small blocks in use */
	int32_t fsmblks;	/* number of bytes in free small blocks */
	int32_t uordblks;	/* number of bytes in ordinary blocks in use */
	int32_t fordblks;	/* number of bytes in free ordinary blocks */
	int32_t keepcost;	/* cost of enabling keep option */
   };	
#endif /* _STRUCT_MALLINFO */

#if defined(__STDC__) || defined(__cplusplus)
_NAMESPACE_STD_START
   void free(void *);
_NAMESPACE_STD_END
   int mallopt(int, int);
   struct mallinfo mallinfo(void);
   void memorymap(int);
#else /* __STDC__ */
   void free();
   int mallopt();
   struct mallinfo mallinfo();
   void memorymap();
#endif /* __STDC__ */

#ifdef _CLASSIC_ANSI_TYPES
   char *calloc();
   void *malloc();
   void *realloc();
#else
#  if defined(__STDC__) || defined(__cplusplus)
_NAMESPACE_STD_START
     void *calloc(size_t, size_t);
     void *malloc(size_t);
     void *realloc(void *, size_t);
_NAMESPACE_STD_END
#  else /* not __STDC__ || __cplusplus */
     void *calloc();
     void *malloc();
     void *realloc();
#  endif /* else not __STDC__ || __cplusplus */
#endif

#ifdef __cplusplus
}
#endif

#endif /* _MALLOC_INCLUDED */
