forked from Imagelibrary/rtems
2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* support/include/test_support.h, support/src/test_support.c: Add Allocate_majority_of_heap().
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2010-07-14 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* support/include/test_support.h, support/src/test_support.c: Add
|
||||||
|
Allocate_majority_of_heap().
|
||||||
|
|
||||||
2010-06-25 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
2010-06-25 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||||
|
|
||||||
* support/src/tmtests_support.c: Fix warning.
|
* support/src/tmtests_support.c: Fix warning.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* COPYRIGHT (c) 1989-2009.
|
* COPYRIGHT (c) 1989-2010.
|
||||||
* On-Line Applications Research Corporation (OAR).
|
* On-Line Applications Research Corporation (OAR).
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
@@ -17,7 +17,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a number of small blocks from the heap
|
* Allocate a number of small blocks from the workspace
|
||||||
* until the largest free block of memory available is
|
* until the largest free block of memory available is
|
||||||
* smaller than smallest.
|
* smaller than smallest.
|
||||||
*
|
*
|
||||||
@@ -25,6 +25,15 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
void Allocate_majority_of_workspace( int smallest );
|
void Allocate_majority_of_workspace( int smallest );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allocate a number of small blocks from the heap
|
||||||
|
* until the largest free block of memory available is
|
||||||
|
* smaller than smallest.
|
||||||
|
*
|
||||||
|
* NOTE: The memory CANNOT be freed.
|
||||||
|
*/
|
||||||
|
void Allocate_majority_of_heap( int smallest );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a pointer to the POSIX name that is slightly
|
* Return a pointer to the POSIX name that is slightly
|
||||||
* beyond the legal limit.
|
* beyond the legal limit.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* COPYRIGHT (c) 1989-2009.
|
* COPYRIGHT (c) 1989-2010.
|
||||||
* On-Line Applications Research Corporation (OAR).
|
* On-Line Applications Research Corporation (OAR).
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
#include "test_support.h"
|
#include "test_support.h"
|
||||||
|
#include <rtems/libcsupport.h>
|
||||||
|
|
||||||
static char Too_Long_Name[PATH_MAX + 2];
|
static char Too_Long_Name[PATH_MAX + 2];
|
||||||
static char Longest_Name[PATH_MAX + 1];
|
static char Longest_Name[PATH_MAX + 1];
|
||||||
@@ -58,3 +59,19 @@ void Allocate_majority_of_workspace( int smallest )
|
|||||||
} while ( info.Free.largest >= smallest );
|
} while ( info.Free.largest >= smallest );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Allocate_majority_of_heap( int smallest )
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
void *temp;
|
||||||
|
|
||||||
|
puts("Allocate_majority_of_heap: ");
|
||||||
|
size = malloc_free_space();
|
||||||
|
do {
|
||||||
|
temp = malloc( size-16 );
|
||||||
|
if (!temp)
|
||||||
|
perror("Unable to allocate from workspace");
|
||||||
|
size = malloc_free_space();
|
||||||
|
} while ( size >= smallest );
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user