diff options
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/include/rtems/libcsupport.h | 7 | ||||
-rw-r--r-- | cpukit/libcsupport/src/newlibc_reent.c | 13 | ||||
-rw-r--r-- | cpukit/libcsupport/src/resource_snapshot.c | 5 |
3 files changed, 18 insertions, 7 deletions
diff --git a/cpukit/libcsupport/include/rtems/libcsupport.h b/cpukit/libcsupport/include/rtems/libcsupport.h index 8e56e4d250..7d40084ece 100644 --- a/cpukit/libcsupport/include/rtems/libcsupport.h +++ b/cpukit/libcsupport/include/rtems/libcsupport.h @@ -90,6 +90,10 @@ void newlib_delete_hook( rtems_tcb *deleted_task ); +void newlib_terminate_hook( + rtems_tcb *current_task +); + #define RTEMS_NEWLIB_EXTENSION \ { \ newlib_create_hook, /* rtems_task_create */ \ @@ -99,7 +103,8 @@ void newlib_delete_hook( 0, /* task_switch */ \ __RTEMS_NEWLIB_BEGIN, /* task_begin */ \ 0, /* task_exitted */ \ - 0 /* fatal */ \ + 0, /* fatal */ \ + newlib_terminate_hook /* thread terminate */ \ } typedef struct { diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c index 88e5e183f8..cd3ac2a0ec 100644 --- a/cpukit/libcsupport/src/newlibc_reent.c +++ b/cpukit/libcsupport/src/newlibc_reent.c @@ -66,13 +66,16 @@ void newlib_delete_hook( rtems_tcb *deleted_task ) { - struct _reent *ptr; + (void) current_task; - ptr = deleted_task->libc_reent; - deleted_task->libc_reent = NULL; + _Workspace_Free(deleted_task->libc_reent); +} - _reclaim_reent(ptr); - _Workspace_Free(ptr); +void newlib_terminate_hook( + rtems_tcb *current_task +) +{ + _reclaim_reent(current_task->libc_reent); } #endif diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c index 8ebbbdc84a..8c66f0f7c2 100644 --- a/cpukit/libcsupport/src/resource_snapshot.c +++ b/cpukit/libcsupport/src/resource_snapshot.c @@ -22,8 +22,9 @@ #include <rtems/libio_.h> #include <rtems/malloc.h> -#include <rtems/score/wkspace.h> #include <rtems/score/protectedheap.h> +#include <rtems/score/threadimpl.h> +#include <rtems/score/wkspace.h> #include <rtems/extensionimpl.h> @@ -116,6 +117,8 @@ void rtems_resource_snapshot_take(rtems_resource_snapshot *snapshot) free_all_delayed_blocks(); + _Thread_Kill_zombies(); + _Protected_heap_Get_information(RTEMS_Malloc_Heap, &snapshot->heap_info); _Thread_Disable_dispatch(); |