[rtems commit] libcsupport: Use _reclaim_reent()
Sebastian Huber
sebh at rtems.org
Wed Jul 17 11:05:28 UTC 2013
Module: rtems
Branch: master
Commit: 8b721d5e11e9b4d6d8998e7b92d34c69b20e2c31
Changeset: http://git.rtems.org/rtems/commit/?id=8b721d5e11e9b4d6d8998e7b92d34c69b20e2c31
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Apr 25 10:48:16 2013 +0200
libcsupport: Use _reclaim_reent()
A Newlib including the following patch is required:
2013-04-25 Sebastian Huber <sebastian.huber at embedded-brains.de>
* libc/stdio/local.h (_STDIO_CLOSE_PER_REENT_STD_STREAMS): New define.
* libc/stdio/findfp.c (_STDIO_CLOSE_PER_REENT_STD_STREAMS): Use define.
---
cpukit/libcsupport/src/newlibc_reent.c | 29 +----------------------------
1 files changed, 1 insertions(+), 28 deletions(-)
diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c
index 364ef8b..972248f 100644
--- a/cpukit/libcsupport/src/newlibc_reent.c
+++ b/cpukit/libcsupport/src/newlibc_reent.c
@@ -25,12 +25,9 @@
#include <sys/reent.h>
#include <stdlib.h>
-#include <stdio.h>
#include <rtems/libcsupport.h>
-int _fwalk(struct _reent *ptr, int (*function) (FILE *) );
-
bool newlib_create_hook(
rtems_tcb *current_task __attribute__((unused)),
rtems_tcb *creating_task
@@ -60,26 +57,6 @@ bool newlib_create_hook(
return ok;
}
-static int newlib_free_buffers(
- FILE *fp
-)
-{
- switch ( fileno(fp) ) {
- case 0:
- case 1:
- case 2:
- if (fp->_flags & __SMBF) {
- free( fp->_bf._base );
- fp->_flags &= ~__SMBF;
- fp->_bf._base = fp->_p = (unsigned char *) NULL;
- }
- break;
- default:
- fclose(fp);
- }
- return 0;
-}
-
void newlib_delete_hook(
rtems_tcb *current_task,
rtems_tcb *deleted_task
@@ -90,11 +67,7 @@ void newlib_delete_hook(
ptr = deleted_task->libc_reent;
deleted_task->libc_reent = NULL;
- /*
- * Just in case there are some buffers lying around.
- */
- _fwalk(ptr, newlib_free_buffers);
-
+ _reclaim_reent(ptr);
_Workspace_Free(ptr);
}
More information about the vc
mailing list