summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio/fflush.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2013-04-10 18:47:46 +0000
committerJeff Johnston <jjohnstn@redhat.com>2013-04-10 18:47:46 +0000
commit602cec7f1eb17b96525d09752fd1f0ad474e3202 (patch)
tree32e10a62bf758fcbb8951c4361a974a7066461c3 /newlib/libc/stdio/fflush.c
parentb49dae4a4443858b2ce51daac3883ad0f1473145 (diff)
downloadcygnal-602cec7f1eb17b96525d09752fd1f0ad474e3202.tar.gz
cygnal-602cec7f1eb17b96525d09752fd1f0ad474e3202.tar.bz2
cygnal-602cec7f1eb17b96525d09752fd1f0ad474e3202.zip
2013-04-10 Bin Cheng <bin.cheng@arm.com>
* acconfig.h (_FSEEK_OPTIMIZATION): Undef * newlib.hin (_FSEEK_OPTIMIZATION): Undef * configure.in (--disable-newlib-fseek-optimization): New option. * configure: Regenerated. * libc/stdio/fflush.c (__sflush_r): Use _FSEEK_OPTIMIZATION to control fseek optimization. * libc/stdio/fseeko.c (_fseeko_r): Ditto. * libc/stdio/makebuf.c (__smakebuf_r): Ditto. * libc/stdio64/fseeko64.c (_fseeko64_r): Ditto.
Diffstat (limited to 'newlib/libc/stdio/fflush.c')
-rw-r--r--newlib/libc/stdio/fflush.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c
index b2bde7af5..ee24cf7ca 100644
--- a/newlib/libc/stdio/fflush.c
+++ b/newlib/libc/stdio/fflush.c
@@ -80,10 +80,12 @@ _DEFUN(__sflush_r, (ptr, fp),
t = fp->_flags;
if ((t & __SWR) == 0)
{
+#ifdef _FSEEK_OPTIMIZATION
/* For a read stream, an fflush causes the next seek to be
unoptimized (i.e. forces a system-level seek). This conforms
to the POSIX and SUSv3 standards. */
fp->_flags |= __SNPT;
+#endif
/* For a seekable stream with buffered read characters, we will attempt
a seek to the current position now. A subsequent read will then get
@@ -152,7 +154,9 @@ _DEFUN(__sflush_r, (ptr, fp),
{
/* Seek successful or ignorable error condition.
We can clear read buffer now. */
+#ifdef _FSEEK_OPTIMIZATION
fp->_flags &= ~__SNPT;
+#endif
fp->_r = 0;
fp->_p = fp->_bf._base;
if ((fp->_flags & __SOFF) && (curoff != -1 || ptr->_errno == 0))