Changeset 1f2d5df in rtems
- Timestamp:
- 09/18/96 20:52:47 (27 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 5e9a594
- Parents:
- b1c215e
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libcsupport/src/malloc.c
rb1c215e r1f2d5df 14 14 */ 15 15 16 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 16 17 #include <rtems.h> 17 18 #include "libcsupport.h" … … 121 122 } 122 123 124 #ifdef RTEMS_NEWLIB 123 125 void *malloc( 124 126 size_t size … … 164 166 the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount); 165 167 166 if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)168 if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) == -1) 167 169 return (void *) 0; 168 170 … … 301 303 } 302 304 } 305 /* end if RTEMS_NEWLIB */ 306 #endif 303 307 304 308 #ifdef MALLOC_STATS … … 321 325 (unsigned int) malloc_stats.max_depth / 1024, 322 326 (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); 325 329 printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", 326 330 malloc_stats.malloc_calls, … … 328 332 malloc_stats.realloc_calls, 329 333 malloc_stats.calloc_calls); 330 } 334 } 335 336 337 void 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 352 void malloc_dump(void) 353 { 354 return; 355 } 356 357 void malloc_walk(size_t source, size_t printf_enabled) 358 { 359 return; 360 } 361 331 362 #endif 332 363 -
c/src/lib/libc/malloc.c
rb1c215e r1f2d5df 14 14 */ 15 15 16 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 16 17 #include <rtems.h> 17 18 #include "libcsupport.h" … … 121 122 } 122 123 124 #ifdef RTEMS_NEWLIB 123 125 void *malloc( 124 126 size_t size … … 164 166 the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount); 165 167 166 if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)168 if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) == -1) 167 169 return (void *) 0; 168 170 … … 301 303 } 302 304 } 305 /* end if RTEMS_NEWLIB */ 306 #endif 303 307 304 308 #ifdef MALLOC_STATS … … 321 325 (unsigned int) malloc_stats.max_depth / 1024, 322 326 (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); 325 329 printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", 326 330 malloc_stats.malloc_calls, … … 328 332 malloc_stats.realloc_calls, 329 333 malloc_stats.calloc_calls); 330 } 334 } 335 336 337 void 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 352 void malloc_dump(void) 353 { 354 return; 355 } 356 357 void malloc_walk(size_t source, size_t printf_enabled) 358 { 359 return; 360 } 361 331 362 #endif 332 363 -
cpukit/libcsupport/src/malloc.c
rb1c215e r1f2d5df 14 14 */ 15 15 16 #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ 16 17 #include <rtems.h> 17 18 #include "libcsupport.h" … … 121 122 } 122 123 124 #ifdef RTEMS_NEWLIB 123 125 void *malloc( 124 126 size_t size … … 164 166 the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount); 165 167 166 if (((rtems_unsigned32)starting_address = sbrk(the_size)) == -1)168 if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) == -1) 167 169 return (void *) 0; 168 170 … … 301 303 } 302 304 } 305 /* end if RTEMS_NEWLIB */ 306 #endif 303 307 304 308 #ifdef MALLOC_STATS … … 321 325 (unsigned int) malloc_stats.max_depth / 1024, 322 326 (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); 325 329 printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", 326 330 malloc_stats.malloc_calls, … … 328 332 malloc_stats.realloc_calls, 329 333 malloc_stats.calloc_calls); 330 } 334 } 335 336 337 void 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 352 void malloc_dump(void) 353 { 354 return; 355 } 356 357 void malloc_walk(size_t source, size_t printf_enabled) 358 { 359 return; 360 } 361 331 362 #endif 332 363
Note: See TracChangeset
for help on using the changeset viewer.