Changeset 1f2d5df in rtems


Ignore:
Timestamp:
09/18/96 20:52:47 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
5e9a594
Parents:
b1c215e
Message:

added malloc_walk

miscellaneous corrections in casting.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/malloc.c

    rb1c215e r1f2d5df  
    1414 */
    1515
     16#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
    1617#include <rtems.h>
    1718#include "libcsupport.h"
     
    121122}
    122123
     124#ifdef RTEMS_NEWLIB
    123125void *malloc(
    124126  size_t  size
     
    164166    the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount);
    165167
    166     if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)
     168    if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) == -1)
    167169      return (void *) 0;
    168170
     
    301303  }
    302304}
     305/* end if RTEMS_NEWLIB */
     306#endif
    303307
    304308#ifdef MALLOC_STATS
     
    321325           (unsigned int) malloc_stats.max_depth / 1024,
    322326           (malloc_stats.max_depth * 100) / malloc_stats.space_available,
    323            (unsigned long long) malloc_stats.lifetime_allocated / 1024,
    324            (unsigned long long) malloc_stats.lifetime_freed / 1024);
     327           (unsigned64) malloc_stats.lifetime_allocated / 1024,
     328           (unsigned64) malloc_stats.lifetime_freed / 1024);
    325329    printf("  Call counts:   malloc:%d   free:%d   realloc:%d   calloc:%d\n",
    326330           malloc_stats.malloc_calls,
     
    328332           malloc_stats.realloc_calls,
    329333           malloc_stats.calloc_calls);
    330 }       
     334}
     335
     336
     337void malloc_walk(size_t source, size_t printf_enabled)
     338{
     339   register Region_Control *the_region;
     340   Objects_Locations        location;
     341 
     342   the_region = _Region_Get( RTEMS_Malloc_Heap, &location );
     343   if ( location == OBJECTS_LOCAL )
     344   {
     345      _Heap_Walk( &the_region->Memory, source, printf_enabled );
     346      _Thread_Enable_dispatch();
     347   }
     348}
     349
     350#else
     351
     352void malloc_dump(void)
     353{
     354   return;
     355}
     356 
     357void malloc_walk(size_t source, size_t printf_enabled)
     358{
     359   return;
     360}
     361
    331362#endif
    332363
  • c/src/lib/libc/malloc.c

    rb1c215e r1f2d5df  
    1414 */
    1515
     16#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
    1617#include <rtems.h>
    1718#include "libcsupport.h"
     
    121122}
    122123
     124#ifdef RTEMS_NEWLIB
    123125void *malloc(
    124126  size_t  size
     
    164166    the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount);
    165167
    166     if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)
     168    if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) == -1)
    167169      return (void *) 0;
    168170
     
    301303  }
    302304}
     305/* end if RTEMS_NEWLIB */
     306#endif
    303307
    304308#ifdef MALLOC_STATS
     
    321325           (unsigned int) malloc_stats.max_depth / 1024,
    322326           (malloc_stats.max_depth * 100) / malloc_stats.space_available,
    323            (unsigned long long) malloc_stats.lifetime_allocated / 1024,
    324            (unsigned long long) malloc_stats.lifetime_freed / 1024);
     327           (unsigned64) malloc_stats.lifetime_allocated / 1024,
     328           (unsigned64) malloc_stats.lifetime_freed / 1024);
    325329    printf("  Call counts:   malloc:%d   free:%d   realloc:%d   calloc:%d\n",
    326330           malloc_stats.malloc_calls,
     
    328332           malloc_stats.realloc_calls,
    329333           malloc_stats.calloc_calls);
    330 }       
     334}
     335
     336
     337void malloc_walk(size_t source, size_t printf_enabled)
     338{
     339   register Region_Control *the_region;
     340   Objects_Locations        location;
     341 
     342   the_region = _Region_Get( RTEMS_Malloc_Heap, &location );
     343   if ( location == OBJECTS_LOCAL )
     344   {
     345      _Heap_Walk( &the_region->Memory, source, printf_enabled );
     346      _Thread_Enable_dispatch();
     347   }
     348}
     349
     350#else
     351
     352void malloc_dump(void)
     353{
     354   return;
     355}
     356 
     357void malloc_walk(size_t source, size_t printf_enabled)
     358{
     359   return;
     360}
     361
    331362#endif
    332363
  • cpukit/libcsupport/src/malloc.c

    rb1c215e r1f2d5df  
    1414 */
    1515
     16#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
    1617#include <rtems.h>
    1718#include "libcsupport.h"
     
    121122}
    122123
     124#ifdef RTEMS_NEWLIB
    123125void *malloc(
    124126  size_t  size
     
    164166    the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount);
    165167
    166     if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)
     168    if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) == -1)
    167169      return (void *) 0;
    168170
     
    301303  }
    302304}
     305/* end if RTEMS_NEWLIB */
     306#endif
    303307
    304308#ifdef MALLOC_STATS
     
    321325           (unsigned int) malloc_stats.max_depth / 1024,
    322326           (malloc_stats.max_depth * 100) / malloc_stats.space_available,
    323            (unsigned long long) malloc_stats.lifetime_allocated / 1024,
    324            (unsigned long long) malloc_stats.lifetime_freed / 1024);
     327           (unsigned64) malloc_stats.lifetime_allocated / 1024,
     328           (unsigned64) malloc_stats.lifetime_freed / 1024);
    325329    printf("  Call counts:   malloc:%d   free:%d   realloc:%d   calloc:%d\n",
    326330           malloc_stats.malloc_calls,
     
    328332           malloc_stats.realloc_calls,
    329333           malloc_stats.calloc_calls);
    330 }       
     334}
     335
     336
     337void malloc_walk(size_t source, size_t printf_enabled)
     338{
     339   register Region_Control *the_region;
     340   Objects_Locations        location;
     341 
     342   the_region = _Region_Get( RTEMS_Malloc_Heap, &location );
     343   if ( location == OBJECTS_LOCAL )
     344   {
     345      _Heap_Walk( &the_region->Memory, source, printf_enabled );
     346      _Thread_Enable_dispatch();
     347   }
     348}
     349
     350#else
     351
     352void malloc_dump(void)
     353{
     354   return;
     355}
     356 
     357void malloc_walk(size_t source, size_t printf_enabled)
     358{
     359   return;
     360}
     361
    331362#endif
    332363
Note: See TracChangeset for help on using the changeset viewer.