This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]


This looks OK to me.

Corinna.. ok to commit?

On 4/25/2013 3:13 AM, Sebastian Huber wrote:
2013-04-25  Sebastian Huber <>

	* libc/stdio/local.h (_STDIO_CLOSE_PER_REENT_STD_STREAMS): New
	* libc/stdio/findfp.c (_STDIO_CLOSE_PER_REENT_STD_STREAMS): Use
  newlib/libc/stdio/findfp.c |    4 ++++
  newlib/libc/stdio/local.h  |   10 ++++++++++
  2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index 7ab3bdb..e40500a 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -62,7 +62,11 @@ _DEFUN(std, (ptr, flags, file, data),
    ptr->_flags |= __SL64;
  #endif /* __LARGE64_FILES */
    ptr->_seek = __sseek;
    ptr->_close = __sclose;
+  ptr->_close = NULL;
  #if !defined(__SINGLE_THREAD__) && !defined(_REENT_SMALL)
    __lock_init_recursive (ptr->_lock);
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index cbfeac7..ec5efab 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -32,6 +32,16 @@
  # include <io.h>
+/* The following define determines if the per-reent stdin, stdout and stderr
+   streams are closed during _reclaim_reent().  The stdin, stdout and stderr
+   streams are initialized to use file descriptors 0, 1 and 2 respectively.  In
+   case _STDIO_CLOSE_PER_REENT_STD_STREAMS is defined these file descriptors
+   will be closed via close() provided the owner of the reent structure
+   triggerd the on demand reent initilization, see CHECK_INIT(). */
+#ifndef __rtems__
  /* The following macros are supposed to replace calls to _flockfile/_funlockfile
     and __sfp_lock_acquire/__sfp_lock_release.  In case of multi-threaded
     environments using pthreads, it's not sufficient to lock the stdio functions

Joel Sherrill, Ph.D.             Director of Research & Development        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]