blob: 757f7b38c692027ef4d8342397701f690e05d3c3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* COPYRIGHT (c) 1989-2010.
* 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$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <fcntl.h>
#include <tmacros.h>
#include "test_support.h"
#include <rtems/libcsupport.h>
static char Too_Long_Name[PATH_MAX + 2];
static char Longest_Name[PATH_MAX + 1];
const char *Get_Too_Long_Name(void)
{
int i;
for ( i=0; i <= PATH_MAX; i++ )
Too_Long_Name[i] = 'E';
Too_Long_Name[i] = '\0';
return Too_Long_Name;
}
const char *Get_Longest_Name(void)
{
int i;
for ( i=0; i < PATH_MAX-1; i++ )
Longest_Name[i] = 'L';
Longest_Name[i] = '\0';
return Longest_Name;
}
void Allocate_majority_of_workspace( int smallest )
{
bool result;
Heap_Information_block info;
void *temp;
puts("Allocate_majority_of_workspace: ");
result = rtems_workspace_get_information( &info );
if ( result != TRUE )
perror("==> Error Getting workspace information");
do {
result = rtems_workspace_allocate(
info.Free.largest - HEAP_BLOCK_HEADER_SIZE,
&temp
);
if ((!result) || (!temp))
perror("Unable to allocate from workspace");
result = rtems_workspace_get_information( &info );
} 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 - HEAP_BLOCK_HEADER_SIZE );
if (!temp)
perror("Unable to allocate from workspace");
size = malloc_free_space();
} while ( size >= smallest );
}
|