forked from Imagelibrary/rtems
2000-10-18 Joel Sherrill <joel@OARcorp.com>
* libc/Makefile.am: Added mallocfreespace.c. * libc/mallocfreespace.c: New file based on work by Nick Simon <Nick.SIMON@syntegra.bt.co.uk> which he included in malloc.c. * libc/libcsupport.h: Added prototype for malloc_free_space().
This commit is contained in:
@@ -33,6 +33,7 @@ extern void malloc_walk(size_t source, size_t printf_enabled);
|
||||
extern void libc_init(int reentrant);
|
||||
extern int host_errno(void);
|
||||
extern void fix_syscall_errno(void);
|
||||
extern size_t malloc_free_space();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ SYSTEM_CALL_C_FILES = open.c close.c read.c write.c lseek.c ioctl.c mkdir.c \
|
||||
DIRECTORY_SCAN_C_FILES = opendir.c closedir.c readdir.c rewinddir.c \
|
||||
scandir.c seekdir.c telldir.c getcwd.c
|
||||
|
||||
MALLOC_C_FILES = malloc.c __brk.c __sbrk.c
|
||||
MALLOC_C_FILES = malloc.c mallocfreespace.c __brk.c __sbrk.c
|
||||
|
||||
PASSWORD_GROUP_C_FILES = getpwent.c getgrent.c
|
||||
|
||||
|
||||
40
c/src/exec/libcsupport/src/mallocfreespace.c
Normal file
40
c/src/exec/libcsupport/src/mallocfreespace.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
|
||||
#include <rtems.h>
|
||||
#include "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 ( region_get_information( RTEMS_Malloc_Heap, &heap_info ) ) {
|
||||
return (size_t) heap_info.free_size;
|
||||
}
|
||||
return (size_t) -1;
|
||||
}
|
||||
@@ -1,4 +1,11 @@
|
||||
|
||||
2000-10-18 Joel Sherrill <joel@OARcorp.com>
|
||||
|
||||
* libc/Makefile.am: Added mallocfreespace.c.
|
||||
* libc/mallocfreespace.c: New file based on work by Nick Simon
|
||||
<Nick.SIMON@syntegra.bt.co.uk> which he included in malloc.c.
|
||||
* libc/libcsupport.h: Added prototype for malloc_free_space().
|
||||
|
||||
2000-10-18 Joel Sherrill <joel@OARcorp.com>
|
||||
|
||||
* libc/fcntl.c: Do not require every filesystem to have an fcntl()
|
||||
|
||||
@@ -33,6 +33,7 @@ extern void malloc_walk(size_t source, size_t printf_enabled);
|
||||
extern void libc_init(int reentrant);
|
||||
extern int host_errno(void);
|
||||
extern void fix_syscall_errno(void);
|
||||
extern size_t malloc_free_space();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ SYSTEM_CALL_C_FILES = open.c close.c read.c write.c lseek.c ioctl.c mkdir.c \
|
||||
DIRECTORY_SCAN_C_FILES = opendir.c closedir.c readdir.c rewinddir.c \
|
||||
scandir.c seekdir.c telldir.c getcwd.c
|
||||
|
||||
MALLOC_C_FILES = malloc.c __brk.c __sbrk.c
|
||||
MALLOC_C_FILES = malloc.c mallocfreespace.c __brk.c __sbrk.c
|
||||
|
||||
PASSWORD_GROUP_C_FILES = getpwent.c getgrent.c
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ extern void malloc_walk(size_t source, size_t printf_enabled);
|
||||
extern void libc_init(int reentrant);
|
||||
extern int host_errno(void);
|
||||
extern void fix_syscall_errno(void);
|
||||
extern size_t malloc_free_space();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
40
c/src/lib/libc/mallocfreespace.c
Normal file
40
c/src/lib/libc/mallocfreespace.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
|
||||
#include <rtems.h>
|
||||
#include "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 ( region_get_information( RTEMS_Malloc_Heap, &heap_info ) ) {
|
||||
return (size_t) heap_info.free_size;
|
||||
}
|
||||
return (size_t) -1;
|
||||
}
|
||||
@@ -33,6 +33,7 @@ extern void malloc_walk(size_t source, size_t printf_enabled);
|
||||
extern void libc_init(int reentrant);
|
||||
extern int host_errno(void);
|
||||
extern void fix_syscall_errno(void);
|
||||
extern size_t malloc_free_space();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
40
cpukit/libcsupport/src/mallocfreespace.c
Normal file
40
cpukit/libcsupport/src/mallocfreespace.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
|
||||
#include <rtems.h>
|
||||
#include "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 ( region_get_information( RTEMS_Malloc_Heap, &heap_info ) ) {
|
||||
return (size_t) heap_info.free_size;
|
||||
}
|
||||
return (size_t) -1;
|
||||
}
|
||||
Reference in New Issue
Block a user