summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include/sys/stdio.h
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2004-09-16 21:30:51 +0000
committerJeff Johnston <jjohnstn@redhat.com>2004-09-16 21:30:51 +0000
commited6859b8f02e456699f85918e4b81457537900fa (patch)
tree301f85ef34f78d17a7497ae6d1807a6e25ccbca5 /newlib/libc/include/sys/stdio.h
parent7a0f696676736d2d8b1d214f9f0cfa5ce8ce76c1 (diff)
downloadcygnal-ed6859b8f02e456699f85918e4b81457537900fa.tar.gz
cygnal-ed6859b8f02e456699f85918e4b81457537900fa.tar.bz2
cygnal-ed6859b8f02e456699f85918e4b81457537900fa.zip
2004-09-16 Antony King <antony.king@st.com>
* libc/include/sys/lock.h: Replaced empty {} with (0) to conform with locking API. * libc/include/sys/stdio.h: (_flockfile)[!_SINGLE_THREAD]: Add check for__SSTR in _flags and if set, skip lock request. (_funlockfile)[!SINGLE_THREAD]: Ditto. * libc/stdio/local.h (CHECK_INIT): Added check that _REENT is not NULL. * libc/stdio/siprintf.c (siprintf, _siprintf_r): Added missing initialisation of _file to -1 in local FILE. * libc/stdio/snprintf.c (snprintf, _snprintf_r): Ditto. * libc/stdio/sscanf.c (sscanf, _sscanf_r): Ditto. * libc/stdio/vsnprintf.c (vsnprintf, _vsnprintf_r): Ditto. * libc/stdio/vsscanf.c (_vsscanf_r): Ditto. * libc/stdio/sscanf.c (sscanf, _sscanf_r): Added __SSTR flag to _flags in local FILE to prevent locking. * libc/stdio/vsscanf.c (_vsscanf_r): Ditto.
Diffstat (limited to 'newlib/libc/include/sys/stdio.h')
-rw-r--r--newlib/libc/include/sys/stdio.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/newlib/libc/include/sys/stdio.h b/newlib/libc/include/sys/stdio.h
index c0cf33893..fa9cd5d0a 100644
--- a/newlib/libc/include/sys/stdio.h
+++ b/newlib/libc/include/sys/stdio.h
@@ -5,10 +5,12 @@
#include <sys/reent.h>
/* Internal locking macros, used to protect stdio functions. In the
- general case, expand to nothing. */
+ general case, expand to nothing. Use __SSTR flag in FILE _flags to
+ detect if FILE is private to sprintf/sscanf class of functions; if
+ set then do nothing as lock is not initialised. */
#if !defined(_flockfile)
#ifndef __SINGLE_THREAD__
-# define _flockfile(fp) __lock_acquire_recursive(fp->_lock)
+# define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock))
#else
# define _flockfile(fp)
#endif
@@ -16,7 +18,7 @@
#if !defined(_funlockfile)
#ifndef __SINGLE_THREAD__
-# define _funlockfile(fp) __lock_release_recursive(fp->_lock)
+# define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock))
#else
# define _funlockfile(fp)
#endif