diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-04-25 10:48:16 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-17 13:09:49 +0200 |
commit | 8b721d5e11e9b4d6d8998e7b92d34c69b20e2c31 (patch) | |
tree | 69fca8edaeab129498f0c6114bcfbeb4451565d0 | |
parent | clean up old atomic related files (diff) | |
download | rtems-8b721d5e11e9b4d6d8998e7b92d34c69b20e2c31.tar.bz2 |
libcsupport: Use _reclaim_reent()
A Newlib including the following patch is required:
2013-04-25 Sebastian Huber <sebastian.huber@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.
-rw-r--r-- | 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 364ef8bbec..972248fa67 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); } |