diff options
Diffstat (limited to 'newlib/libc/include')
-rw-r--r-- | newlib/libc/include/stdio.h | 6 | ||||
-rw-r--r-- | newlib/libc/include/sys/config.h | 4 | ||||
-rw-r--r-- | newlib/libc/include/sys/reent.h | 9 |
3 files changed, 18 insertions, 1 deletions
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index ccc048dec..73204cb72 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -131,9 +131,15 @@ typedef struct __sFILE FILE; #define TMP_MAX 26 +#ifndef _REENT_ONLY +#define stdin (_REENT->_stdin) +#define stdout (_REENT->_stdout) +#define stderr (_REENT->_stderr) +#else /* _REENT_ONLY */ #define stdin (_impure_ptr->_stdin) #define stdout (_impure_ptr->_stdout) #define stderr (_impure_ptr->_stderr) +#endif /* _REENT_ONLY */ #define _stdin_r(x) ((x)->_stdin) #define _stdout_r(x) ((x)->_stdout) diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 05ba2681c..b5ecfb882 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -54,6 +54,10 @@ /* in other words, go32 */ #define _FLOAT_RET double #endif +#ifdef __linux__ +/* we want the reentrancy structure to be returned by a function */ +#define __DYNAMIC_REENT__ +#endif #endif #ifdef __M32R__ diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 5303ed3dd..1edfad696 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -607,7 +607,14 @@ void _reclaim_reent _PARAMS ((struct _reent *)); /* #define _REENT_ONLY define this to get only reentrant routines */ #ifndef _REENT_ONLY -#define _REENT _impure_ptr + +#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__) + struct _reent * _EXFUN(__getreent, (void)); +# define _REENT (__getreent()) +#else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */ +# define _REENT _impure_ptr +#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */ + #endif /* !_REENT_ONLY */ #ifdef __cplusplus |