From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 318 invoked by alias); 9 Feb 2003 10:26:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 303 invoked by uid 71); 9 Feb 2003 10:26:01 -0000 Date: Sun, 09 Feb 2003 10:26:00 -0000 Message-ID: <20030209102601.302.qmail@sources.redhat.com> To: aj@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Andreas Jaeger Subject: Re: libstdc++/8610: std::streamoff type is 32-bit in GCC 3.2 whereas it was 64-bit in GCC 2.96 Reply-To: Andreas Jaeger X-SW-Source: 2003-02/txt/msg00428.txt.bz2 List-Id: The following reply was made to PR libstdc++/8610; it has been noted by GNATS. From: Andreas Jaeger To: Paolo Carlini Cc: paolo@gcc.gnu.org, davido@csse.uwa.edu.au, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: libstdc++/8610: std::streamoff type is 32-bit in GCC 3.2 whereas it was 64-bit in GCC 2.96 Date: Sun, 09 Feb 2003 11:21:38 +0100 Paolo Carlini writes: > Andreas Jaeger wrote: > >>Paolo, I need some help here since I don't know the internals of >>libstc++. >> > Hi Andreas and thanks for your _very_ quick reply! > My impression, in general, is that enabling LFS for libstdc++ is a > new project! I would appreciate having some general guidelines from > you and trying to work on it in the next few months... > So: > >>/opt/gcc/3.4-devel/include/c++/3.4/i686-pc-linux-gnu/bits/c++io.h >>(where does this file come from?) indeed defines: >> namespace std { >>// for fpos.h >> typedef long streamoff; >> typedef ptrdiff_t streamsize; // Signed integral type >> > It comes from libstdc++-v3/config/io/c_io_stdio.h. It's wrong, right? > What should be, instead, off64_t? It really depends on the functions you use - if you use fseek/ftell, it's right. But if you compile with _FILE_OFFSET_BITS=64 and use ftello/fseeko, you need off_t which is in this case a 64-bit variable. Or use fseeko64/ftello64 with off64_t, or fsetpos64/fgetpos64 with fpos64_t. > Is this the correct type, which becomes a real 64 bit type as soon > as _FILE_OFFSET_BITS=64 is defined? off_t becomes 64-bit if you use that define. > Also, why _two_ different defines are needed, both _FILE_OFFSET_BITS=64 > and _LARGEFILE_SOURCE ?? Could you please explain a bit? _FILE_OFFSET_BITS=64 basically renames the types and functions so that instead of fsetpos, fsetpos64 is called. _LARGEFILE_SOURCE gives only the declaration for 64-bit types and functions without the renaming, so that your program can use both fsetpos and fsetpos64. >>And libstdc++/config/io/c_io_libio.h has: >> > Disregard this file: it was only used by the old libio. > >>But the problem is even more subitle. config/io/basic_file_stdio.cc >>uses fseek/ftell which use a long int and therefore - under 32-bit - >>allow only 2 GB. You should use fseeko/ftello or fsetpos/fgetpos. >> > I see... Isn't possible to have a single name for both 32 and 64 bit > which transparently adapts according to the value of the defines?? > Is it fseeko/ftello? Yes - or fsetpos/fgetpos. > I read in the glibc docs that open64 for instance can be avoided and > only open used transaparently... With _FILE_OFFSET_BITS=64 > In your opinion, which amount of transparency can be achieved? > I mean, it will ever be possible to have one single libstdc++, which, > without configure magic, becomes LFS only by setting > _FILE_OFFSET_BITS=64 and _LARGEFILE_SOURCE when it's compiled? Using _FILE_OFFSET_BITS=64 would work if we use off_t and avoid fseek/ftell. But it might give an incompatible lib depending which define is use. I therefore advise to use _LARGEFILE_SOURCE only and call the 64-bit functions directly. > Thanks for your past and future help, ;-) Btw. What shall we do with this PR? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj