Commit 3d05b345 by Paolo Carlini Committed by Paolo Carlini

re PR libstdc++/8610 (large file support in libstdc++-v3 (std::streamoff type …

re PR libstdc++/8610 (large file support in libstdc++-v3 (std::streamoff type  is 32-bit  in GCC 3.2 whereas it was 64-bit in GCC 2.96))

2003-10-22  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/8610
	* acinclude.m4 (GLIBCXX_CHECK_INT64_T): New macro,
	checking for the availability of int64_t.
	(GLIBCXX_CHECK_LFS): New macro, checking for LFS support.
	* configure.ac: Call here.
	* acconfig.h: Add undef for the corresponding symbols.
	* config/io/basic_file_stdio.cc	(__basic_file<char>::open):
	Depending on _GLIBCXX_USE_LFS, call fopen64 or fopen.
	(__basic_file<char>::seekoff): Likewise, call lseek64 when
	available, otherwise lseek, checking the __off parameter.
	* include/bits/postypes.h: Typedef __streamoff_base_type
	to int64_t if available, otherwise long long.
	* aclocal.m4: Regenerate.
	* config.h.in: Likewise.
	* configure: Likewise.

	* acinclude.m4 (GLIBCXX_CHECK_POLL, GLIBCXX_CHECK_WRITEV):
	Use AC_TRY_LINK instead of AC_TRY_COMPILE.

From-SVN: r72806
parent 36ae3d8e
2003-10-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/8610
* acinclude.m4 (GLIBCXX_CHECK_INT64_T): New macro,
checking for the availability of int64_t.
(GLIBCXX_CHECK_LFS): New macro, checking for LFS support.
* configure.ac: Call here.
* acconfig.h: Add undef for the corresponding symbols.
* config/io/basic_file_stdio.cc (__basic_file<char>::open):
Depending on _GLIBCXX_USE_LFS, call fopen64 or fopen.
(__basic_file<char>::seekoff): Likewise, call lseek64 when
available, otherwise lseek, checking the __off parameter.
* include/bits/postypes.h: Typedef __streamoff_base_type
to int64_t if available, otherwise long long.
* aclocal.m4: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* acinclude.m4 (GLIBCXX_CHECK_POLL, GLIBCXX_CHECK_WRITEV):
Use AC_TRY_LINK instead of AC_TRY_COMPILE.
2003-10-22 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/12657
* include/bits/basic_ios.tcc (copyfmt(const basic_ios&)):
Implement resolution of DR 292 (WP).
......
......@@ -153,6 +153,12 @@
// Define if writev is available in <sys/uio.h>.
#undef HAVE_WRITEV
// Define if int64_t is available in <stdint.h>.
#undef HAVE_INT64_T
// Define if LFS support is available.
#undef _GLIBCXX_USE_LFS
// Define if LC_MESSAGES is available in <locale.h>.
#undef HAVE_LC_MESSAGES
......
......@@ -540,7 +540,7 @@ dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
dnl
AC_DEFUN(GLIBCXX_CHECK_POLL, [
AC_CACHE_VAL(glibcxx_cv_POLL, [
AC_TRY_COMPILE(
AC_TRY_LINK(
[#include <poll.h>],
[struct pollfd pfd[1];
pfd[0].events = POLLIN;
......@@ -559,7 +559,7 @@ dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
dnl
AC_DEFUN(GLIBCXX_CHECK_WRITEV, [
AC_CACHE_VAL(glibcxx_cv_WRITEV, [
AC_TRY_COMPILE(
AC_TRY_LINK(
[#include <sys/uio.h>],
[struct iovec iov[2];
writev(0, iov, 0);],
......@@ -573,6 +573,41 @@ AC_DEFUN(GLIBCXX_CHECK_WRITEV, [
dnl
dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
dnl
AC_DEFUN(GLIBCXX_CHECK_INT64_T, [
AC_CACHE_VAL(glibcxx_cv_INT64_T, [
AC_TRY_COMPILE(
[#include <stdint.h>],
[int64_t var;],
[glibcxx_cv_INT64_T=yes],
[glibcxx_cv_INT64_T=no])
])
if test $glibcxx_cv_INT64_T = yes; then
AC_DEFINE(HAVE_INT64_T)
fi
])
dnl
dnl Check whether LFS support is available.
dnl
AC_DEFUN(GLIBCXX_CHECK_LFS, [
AC_CACHE_VAL(glibcxx_cv_LFS, [
AC_TRY_LINK(
[#include <unistd.h>],
[fopen64("t", "w");
lseek64(1, 0, SEEK_CUR);],
[glibcxx_cv_LFS=yes],
[glibcxx_cv_LFS=no])
])
if test $glibcxx_cv_LFS = yes; then
AC_DEFINE(_GLIBCXX_USE_LFS)
fi
])
dnl
dnl Does any necessary configuration of the testsuite directory. Generates
dnl the testsuite_hooks.h header.
dnl
......
......@@ -553,7 +553,7 @@ dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
dnl
AC_DEFUN(GLIBCXX_CHECK_POLL, [
AC_CACHE_VAL(glibcxx_cv_POLL, [
AC_TRY_COMPILE(
AC_TRY_LINK(
[#include <poll.h>],
[struct pollfd pfd[1];
pfd[0].events = POLLIN;
......@@ -572,7 +572,7 @@ dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
dnl
AC_DEFUN(GLIBCXX_CHECK_WRITEV, [
AC_CACHE_VAL(glibcxx_cv_WRITEV, [
AC_TRY_COMPILE(
AC_TRY_LINK(
[#include <sys/uio.h>],
[struct iovec iov[2];
writev(0, iov, 0);],
......@@ -586,6 +586,41 @@ AC_DEFUN(GLIBCXX_CHECK_WRITEV, [
dnl
dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
dnl
AC_DEFUN(GLIBCXX_CHECK_INT64_T, [
AC_CACHE_VAL(glibcxx_cv_INT64_T, [
AC_TRY_COMPILE(
[#include <stdint.h>],
[int64_t var;],
[glibcxx_cv_INT64_T=yes],
[glibcxx_cv_INT64_T=no])
])
if test $glibcxx_cv_INT64_T = yes; then
AC_DEFINE(HAVE_INT64_T)
fi
])
dnl
dnl Check whether LFS support is available.
dnl
AC_DEFUN(GLIBCXX_CHECK_LFS, [
AC_CACHE_VAL(glibcxx_cv_LFS, [
AC_TRY_LINK(
[#include <unistd.h>],
[fopen64("t", "w");
lseek64(1, 0, SEEK_CUR);],
[glibcxx_cv_LFS=yes],
[glibcxx_cv_LFS=no])
])
if test $glibcxx_cv_LFS = yes; then
AC_DEFINE(_GLIBCXX_USE_LFS)
fi
])
dnl
dnl Does any necessary configuration of the testsuite directory. Generates
dnl the testsuite_hooks.h header.
dnl
......
......@@ -154,6 +154,12 @@
// Define if writev is available in <sys/uio.h>.
#undef HAVE_WRITEV
// Define if int64_t is available in <stdint.h>.
#undef HAVE_INT64_T
// Define if LFS support is available.
#undef _GLIBCXX_USE_LFS
// Define if LC_MESSAGES is available in <locale.h>.
#undef HAVE_LC_MESSAGES
......
......@@ -68,6 +68,8 @@
# endif
#endif
#include <limits> // For <off_t>::max() and min()
namespace std
{
// Definitions for __basic_file<char>.
......@@ -173,7 +175,11 @@ namespace std
if (!this->is_open())
{
#ifdef _GLIBCXX_USE_LFS
if ((_M_cfile = fopen64(__name, __c_mode)))
#else
if ((_M_cfile = fopen(__name, __c_mode)))
#endif
{
_M_cfile_created = true;
__ret = this;
......@@ -262,7 +268,16 @@ namespace std
streamoff
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way)
{ return lseek(this->fd(), __off, __way); }
{
#ifdef _GLIBCXX_USE_LFS
return lseek64(this->fd(), __off, __way);
#else
if (__off > std::numeric_limits<off_t>::max()
|| __off < std::numeric_limits<off_t>::min())
return -1L;
return lseek(this->fd(), __off, __way);
#endif
}
int
__basic_file<char>::sync()
......
......@@ -134,6 +134,12 @@ if $GLIBCXX_IS_NATIVE; then
AC_CHECK_HEADERS(sys/uio.h)
GLIBCXX_CHECK_WRITEV
# For the __streamoff_base_type typedef.
GLIBCXX_CHECK_INT64_T
# For LFS support.
GLIBCXX_CHECK_LFS
AC_LC_MESSAGES
AC_TRY_COMPILE(
......
......@@ -45,6 +45,10 @@
#include <cwchar> // For mbstate_t
#ifdef _GLIBCXX_HAVE_STDINT_H
#include <stdint.h> // For int64_t
#endif
namespace std
{
// The types streamoff, streampos and wstreampos and the class
......@@ -52,8 +56,14 @@ namespace std
// 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbage, the
// behaviour of these types is mostly implementation defined or
// unspecified. The behaviour in this implementation is as noted
// below.
typedef long __streamoff_base_type;
// below.
#ifdef _GLIBCXX_HAVE_INT64_T
typedef int64_t __streamoff_base_type;
#else
typedef long long __streamoff_base_type;
#endif
typedef ptrdiff_t streamsize; // Signed integral type
template<typename _StateT>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment