Changeset 77998753 in rtems


Ignore:
Timestamp:
Feb 17, 2012, 3:54:23 PM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
39e8aa9
Parents:
622d670
git-author:
Sebastian Huber <sebastian.huber@…> (02/17/12 15:54:23)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/17/12 15:56:17)
Message:

Use alternative API

Replaced Allocate_majority_of_workspace() with
rtems_workspace_allocate(). Replaced Allocate_majority_of_heap() with
rtems_heap_greedy_allocate().

Location:
testsuites
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxkey01/init.c

    r622d670 r77998753  
    1818#include <errno.h>
    1919#include "tmacros.h"
    20 #include <rtems/score/wkspace.h>
    21 #include <rtems/score/heap.h>
    22 
    23 #include "test_support.h"
    2420
    2521void Key_destructor(
     
    4743  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
    4844
    49   Allocate_majority_of_workspace(84);
     45  rtems_workspace_greedy_allocate( 0 );
    5046
    5147  puts("Init: pthread_key_create - ENOMEM (Workspace not available)");
  • testsuites/psxtests/psxmsgq02/init.c

    r622d670 r77998753  
    1818#include <errno.h>
    1919#include "tmacros.h"
    20 #include <rtems/score/wkspace.h>
    21 #include <rtems/score/heap.h>
    2220#include <mqueue.h>
    2321#include <sched.h>
     
    2624#include <tmacros.h>
    2725#include <signal.h>   /* signal facilities */
    28 #include "test_support.h"
    2926
    3027pthread_t        Init_id;
     
    4946  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
    5047
    51   Allocate_majority_of_workspace(NAME_MAX);
     48  rtems_workspace_greedy_allocate( 0 );
    5249
    5350  attr.mq_maxmsg  = MAXMSG;
  • testsuites/psxtests/psxobj01/init.c

    r622d670 r77998753  
    1717#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
    1818#include <tmacros.h>
    19 #include "test_support.h"
    2019
    2120rtems_task Init(
     
    7170  /* out of memory error ONLY when POSIX is enabled */
    7271  puts( "INIT - _Objects_Set_name fails - out of memory" );
    73   Allocate_majority_of_workspace( 1 );
     72  rtems_workspace_greedy_allocate( 0 );
    7473
    7574  bc = _Objects_Set_name( &TestClass, &_Thread_Executing->Object, name );
  • testsuites/sptests/spfatal22/testcase.h

    r622d670 r77998753  
    1717
    1818#include <rtems/libio.h>
    19 #include "test_support.h"
     19#include <rtems/malloc.h>
    2020
    2121void force_error()
    2222{
    23   Allocate_majority_of_heap( 1 );
     23  rtems_heap_greedy_allocate( 0 );
    2424
    2525  rtems_libio_init();
  • testsuites/support/include/test_support.h

    r622d670 r77998753  
    1616extern "C" {
    1717#endif
    18 
    19 /*
    20  *  Allocate a number of small blocks from the workspace
    21  *  until the largest free block of memory available is
    22  *  smaller than smallest.
    23  *
    24  *  NOTE: The memory CANNOT be freed.
    25  */
    26 void Allocate_majority_of_workspace( int smallest );
    27 
    28 /*
    29  *  Allocate a number of small blocks from the heap
    30  *  until the largest free block of memory available is
    31  *  smaller than smallest.
    32  *
    33  *  NOTE: The memory CANNOT be freed.
    34  */
    35 void Allocate_majority_of_heap( int smallest );
    3618
    3719/*
  • testsuites/support/src/test_support.c

    r622d670 r77998753  
    4141  return Longest_Name;
    4242}
    43 
    44 void Allocate_majority_of_workspace( int smallest )
    45 {
    46   bool                   result;
    47   Heap_Information_block info;
    48   void                   *temp;
    49 
    50   puts("Allocate_majority_of_workspace: ");
    51   result = rtems_workspace_get_information( &info );
    52   if ( result != TRUE )
    53     perror("==> Error Getting workspace information");
    54 
    55   do {
    56     result = rtems_workspace_allocate(
    57       info.Free.largest - HEAP_BLOCK_HEADER_SIZE,
    58       &temp
    59     );
    60     if ((!result) || (!temp))
    61       perror("Unable to allocate from workspace");
    62     result = rtems_workspace_get_information( &info );
    63   } while ( info.Free.largest >= smallest );
    64 
    65 }
    66 
    67 void Allocate_majority_of_heap( int smallest )
    68 {
    69   size_t    size;
    70   void     *temp;
    71 
    72   puts("Allocate_majority_of_heap: ");
    73   size = malloc_free_space();
    74   do {
    75     temp = malloc( size - HEAP_BLOCK_HEADER_SIZE );
    76     if (!temp)
    77       perror("Unable to allocate from workspace");
    78     size = malloc_free_space();
    79   } while ( size >= smallest );
    80 
    81 }
Note: See TracChangeset for help on using the changeset viewer.