diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-02-25 09:02:43 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-02-25 11:35:54 +0100 |
commit | 9d1f39434585e8d3f8897d95a2bfe1ddccb79aec (patch) | |
tree | 2d3a0868f410cff137871f5ce493df4f27a22b1a /cpukit/libcsupport/src/malloc_p.h | |
parent | malloc: Use dedicated lock for deferred frees (diff) | |
download | rtems-9d1f39434585e8d3f8897d95a2bfe1ddccb79aec.tar.bz2 |
malloc: Add _Malloc_System_state()
Replace malloc_is_system_state_OK() with _Malloc_System_state() to allow
early allocations, e.g. in bsp_start(). Here the _Thread_Executing is
NULL, thus an _API_Mutex_Lock() would lead to a NULL pointer access.
Move malloc() support code to general case
rtems_heap_allocate_aligned_with_boundary(). Use
rtems_heap_allocate_aligned_with_boundary() to avoid duplicated code.
Diffstat (limited to 'cpukit/libcsupport/src/malloc_p.h')
-rw-r--r-- | cpukit/libcsupport/src/malloc_p.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cpukit/libcsupport/src/malloc_p.h b/cpukit/libcsupport/src/malloc_p.h index 6609526fa8..127f22bac4 100644 --- a/cpukit/libcsupport/src/malloc_p.h +++ b/cpukit/libcsupport/src/malloc_p.h @@ -17,12 +17,15 @@ extern "C" { #endif /* __cplusplus */ -/* - * Process deferred free operations - */ -bool malloc_is_system_state_OK(void); -void malloc_deferred_frees_process(void); -void malloc_deferred_free(void *); +typedef enum { + MALLOC_SYSTEM_STATE_NORMAL, + MALLOC_SYSTEM_STATE_NO_PROTECTION, + MALLOC_SYSTEM_STATE_NO_ALLOCATION +} Malloc_System_state; + +Malloc_System_state _Malloc_System_state( void ); + +void _Malloc_Deferred_free( void * ); #ifdef __cplusplus } |