Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2013-04-10 22:47:46 +0400
committerJeff Johnston <jjohnstn@redhat.com>2013-04-10 22:47:46 +0400
commit602cec7f1eb17b96525d09752fd1f0ad474e3202 (patch)
tree32e10a62bf758fcbb8951c4361a974a7066461c3
parentb49dae4a4443858b2ce51daac3883ad0f1473145 (diff)
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.
-rw-r--r--newlib/ChangeLog11
-rw-r--r--newlib/acconfig.h3
-rwxr-xr-xnewlib/configure26
-rw-r--r--newlib/configure.in15
-rw-r--r--newlib/libc/stdio/fflush.c4
-rw-r--r--newlib/libc/stdio/fseeko.c3
-rw-r--r--newlib/libc/stdio/makebuf.c4
-rw-r--r--newlib/libc/stdio64/fseeko64.c3
-rw-r--r--newlib/newlib.hin3
9 files changed, 70 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index a37ff28e9..2c4d024bb 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,14 @@
+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.
+
2013-04-08 Matthew Gretton-Dann <matthew.gretton-dann@linaro.org>
* libc/stdio/vfieeefp.h (ldieee): Fix typo.
diff --git a/newlib/acconfig.h b/newlib/acconfig.h
index 42b38d232..3d26b826d 100644
--- a/newlib/acconfig.h
+++ b/newlib/acconfig.h
@@ -58,6 +58,9 @@
/* Define if ivo supported in streamio. */
#undef _FVWRITE_IN_STREAMIO
+/* Define if fseek functions support seek optimization. */
+#undef _FSEEK_OPTIMIZATION
+
@BOTTOM@
/*
* Iconv encodings enabled ("to" direction)
diff --git a/newlib/configure b/newlib/configure
index 71499b57f..e57fcf7f5 100755
--- a/newlib/configure
+++ b/newlib/configure
@@ -790,6 +790,7 @@ enable_newlib_iconv_external_ccs
enable_newlib_atexit_dynamic_alloc
enable_newlib_reent_small
enable_newlib_fvwrite_in_streamio
+enable_newlib_fseek_optimization
enable_multilib
enable_target_optspace
enable_malloc_debugging
@@ -1454,6 +1455,7 @@ Optional Features:
--disable-newlib-atexit-alloc disable dynamic allocation of atexit entries
--enable-newlib-reent-small enable small reentrant struct support
--disable-newlib-fvwrite-in-streamio disable iov in streamio
+ --disable-newlib-fseek-optimization disable fseek optimization
--enable-multilib build many library versions (default)
--enable-target-optspace optimize for space
--enable-malloc-debugging indicate malloc debugging requested
@@ -2366,6 +2368,19 @@ else
newlib_fvwrite_in_streamio=yes
fi
+# Check whether --enable-newlib-fseek-optimization was given.
+if test "${enable_newlib_fseek_optimization+set}" = set; then :
+ enableval=$enable_newlib_fseek_optimization; if test "${newlib_fseek_optimization+set}" != set; then
+ case "${enableval}" in
+ yes) newlib_fseek_optimization=yes ;;
+ no) newlib_fseek_optimization=no ;;
+ *) as_fn_error $? "bad value ${enableval} for newlib-fseek-optimization option" "$LINENO" 5 ;;
+ esac
+ fi
+else
+ newlib_fseek_optimization=yes
+fi
+
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -11666,7 +11681,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11654 "configure"
+#line 11684 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11772,7 +11787,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11760 "configure"
+#line 11790 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12254,6 +12269,13 @@ _ACEOF
fi
+if test "${newlib_fseek_optimization}" = "yes"; then
+cat >>confdefs.h <<_ACEOF
+#define _FSEEK_OPTIMIZATION 1
+_ACEOF
+
+fi
+
if test "x${iconv_encodings}" != "x" \
|| test "x${iconv_to_encodings}" != "x" \
diff --git a/newlib/configure.in b/newlib/configure.in
index daabcf276..f4a65c0df 100644
--- a/newlib/configure.in
+++ b/newlib/configure.in
@@ -135,6 +135,17 @@ AC_ARG_ENABLE(newlib-fvwrite-in-streamio,
esac
fi], [newlib_fvwrite_in_streamio=yes])dnl
+dnl Support --disable-newlib-fseek-optimization
+AC_ARG_ENABLE(newlib-fseek-optimization,
+[ --disable-newlib-fseek-optimization disable fseek optimization],
+[if test "${newlib_fseek_optimization+set}" != set; then
+ case "${enableval}" in
+ yes) newlib_fseek_optimization=yes ;;
+ no) newlib_fseek_optimization=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for newlib-fseek-optimization option) ;;
+ esac
+ fi], [newlib_fseek_optimization=yes])dnl
+
NEWLIB_CONFIGURE(.)
dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and
@@ -327,6 +338,10 @@ fi
if test "${newlib_fvwrite_in_streamio}" = "yes"; then
AC_DEFINE_UNQUOTED(_FVWRITE_IN_STREAMIO)
fi
+
+if test "${newlib_fseek_optimization}" = "yes"; then
+AC_DEFINE_UNQUOTED(_FSEEK_OPTIMIZATION)
+fi
dnl
dnl Parse --enable-newlib-iconv-encodings option argument
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))
diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c
index 97eafd9ca..2c9419d97 100644
--- a/newlib/libc/stdio/fseeko.c
+++ b/newlib/libc/stdio/fseeko.c
@@ -219,6 +219,8 @@ _DEFUN(_fseeko_r, (ptr, fp, offset, whence),
if (fp->_bf._base == NULL)
__smakebuf_r (ptr, fp);
+
+#ifdef _FSEEK_OPTIMIZATION
if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
goto dumb;
if ((fp->_flags & __SOPT) == 0)
@@ -350,6 +352,7 @@ _DEFUN(_fseeko_r, (ptr, fp, offset, whence),
* We get here if we cannot optimise the seek ... just
* do it. Allow the seek function to change fp->_bf._base.
*/
+#endif
dumb:
if (_fflush_r (ptr, fp)
diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c
index a3f47e2f7..349783ded 100644
--- a/newlib/libc/stdio/makebuf.c
+++ b/newlib/libc/stdio/makebuf.c
@@ -65,8 +65,10 @@ _DEFUN(__smakebuf_r, (ptr, fp),
size = _DEFAULT_ASPRINTF_BUFSIZE;
else
size = BUFSIZ;
+#ifdef _FSEEK_OPTIMIZATION
/* do not try to optimise fseek() */
fp->_flags |= __SNPT;
+#endif
}
else
{
@@ -76,6 +78,7 @@ _DEFUN(__smakebuf_r, (ptr, fp),
#else
size = BUFSIZ;
#endif
+#ifdef _FSEEK_OPTIMIZATION
/*
* Optimize fseek() only if it is a regular file.
* (The test for __sseek is mainly paranoia.)
@@ -91,6 +94,7 @@ _DEFUN(__smakebuf_r, (ptr, fp),
}
else
fp->_flags |= __SNPT;
+#endif
}
if ((p = _malloc_r (ptr, size)) == NULL)
{
diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c
index b323f97d8..d605dd09b 100644
--- a/newlib/libc/stdio64/fseeko64.c
+++ b/newlib/libc/stdio64/fseeko64.c
@@ -209,6 +209,8 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence),
if (fp->_bf._base == NULL)
__smakebuf_r (ptr, fp);
+
+#if _FSEEK_OPTIMIZATION
if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
goto dumb;
if ((fp->_flags & __SOPT) == 0)
@@ -330,6 +332,7 @@ _DEFUN (_fseeko64_r, (ptr, fp, offset, whence),
* We get here if we cannot optimise the seek ... just
* do it. Allow the seek function to change fp->_bf._base.
*/
+#endif
dumb:
if (_fflush_r (ptr, fp)
diff --git a/newlib/newlib.hin b/newlib/newlib.hin
index 74218c73e..f9206e916 100644
--- a/newlib/newlib.hin
+++ b/newlib/newlib.hin
@@ -61,6 +61,9 @@
/* Define if ivo supported in streamio. */
#undef _FVWRITE_IN_STREAMIO
+/* Define if fseek functions support seek optimization. */
+#undef _FSEEK_OPTIMIZATION
+
/*
* Iconv encodings enabled ("to" direction)
*/