diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-17 22:36:45 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-17 22:36:45 +0000 |
commit | ad9255bedd57ee4ba0b855ff514c0718347bf6fb (patch) | |
tree | b8b2dd5bfaaeb8c0a8576a95c4aa23765e76488b /cpukit/libcsupport | |
parent | 2007-12-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-ad9255bedd57ee4ba0b855ff514c0718347bf6fb.tar.bz2 |
2007-12-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/Makefile.am, libcsupport/src/mallocfreespace.c: Add
malloc_info() routine.
* libcsupport/src/mallocinfo.c: New file.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/Makefile.am | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/mallocfreespace.c | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/mallocinfo.c | 41 |
3 files changed, 45 insertions, 4 deletions
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index 893f06339b..36aee4bc98 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -78,8 +78,8 @@ ID_C_FILES = src/getegid.c src/geteuid.c src/getgid.c src/getgroups.c \ src/getlogin.c src/getpgrp.c src/getpid.c src/getppid.c src/getuid.c \ src/setpgid.c src/setsid.c -MALLOC_C_FILES = src/malloc.c src/mallocfreespace.c src/__brk.c \ - src/__sbrk.c +MALLOC_C_FILES = src/malloc.c src/mallocfreespace.c src/mallocinfo.c \ + src/__brk.c src/__sbrk.c PASSWORD_GROUP_C_FILES = src/getpwent.c diff --git a/cpukit/libcsupport/src/mallocfreespace.c b/cpukit/libcsupport/src/mallocfreespace.c index 51a02fc51f..aaf1016194 100644 --- a/cpukit/libcsupport/src/mallocfreespace.c +++ b/cpukit/libcsupport/src/mallocfreespace.c @@ -1,8 +1,8 @@ /* - * RTEMS Malloc Get Status Information + * RTEMS Malloc Get Free Information * * - * COPYRIGHT (c) 1989-2000. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be diff --git a/cpukit/libcsupport/src/mallocinfo.c b/cpukit/libcsupport/src/mallocinfo.c new file mode 100644 index 0000000000..2868ff819e --- /dev/null +++ b/cpukit/libcsupport/src/mallocinfo.c @@ -0,0 +1,41 @@ +/* + * RTEMS Malloc Get Status Information + * + * + * COPYRIGHT (c) 1989-2007. + * 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 <rtems/score/protectedheap.h> + +extern Heap_Control RTEMS_Malloc_Heap; + +/* + * Find amount of free heap remaining + */ + +int malloc_info( + Heap_Information_block *the_info +) +{ + Heap_Information info; + + if ( !the_info ) + return -1; + + _Protected_heap_Get_information( &RTEMS_Malloc_Heap, the_info ); + return 0; +} |