Files
rtems/cpukit/libcsupport/src/mallocfreespace.c
Joel Sherrill 9b3f187a02 2004-11-29 Joel Sherrill <joel@OARcorp.com>
* libcsupport/src/mallocfreespace.c, rtems/Makefile.am,
	rtems/include/rtems/rtems/region.h, score/Makefile.am,
	score/include/rtems/score/heap.h, score/src/heapgetinfo.c: Add
	capability to return information about just the free blocks in a
	region or heap.  Also changed the semantics of free space available
	to be the largest block of memory that can be allocated.
	* rtems/src/regiongetfreeinfo.c, score/src/heapgetfreeinfo.c: New files.
	: score/include/rtems/score/object.h,
	score/src/objectinitializeinformation.c: Remove warning.
2004-11-29 22:45:43 +00:00

45 lines
883 B
C

/*
* RTEMS Malloc Get Status Information
*
*
* COPYRIGHT (c) 1989-2000.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#include <rtems.h>
#include <rtems/libcsupport.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
extern rtems_id RTEMS_Malloc_Heap;
/*
* Find amount of free heap remaining
*/
size_t malloc_free_space( void )
{
region_information_block heap_info;
if ( !rtems_region_get_free_information( RTEMS_Malloc_Heap, &heap_info ) ) {
return (size_t) heap_info.Free.largest;
}
return (size_t) -1;
}