Re: [Boost-bugs] [Boost C++ Libraries] #8305: Allow interprocess to work with big files on x32 POSIX systems

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8305: Allow interprocess to work with big files on x32 POSIX systems
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-19 07:15:30


#8305: Allow interprocess to work with big files on x32 POSIX systems
---------------------------+------------------------------------------------
  Reporter: apolukhin | Owner: igaztanaga
      Type: Patches | Status: new
 Milestone: Boost 1.54.0 | Component: interprocess
   Version: Boost 1.53.0 | Severity: Problem
Resolution: | Keywords: mmap _LARGEFILE64_SOURCE _FILE_OFFSET_BITS==64
---------------------------+------------------------------------------------

Comment (by apolukhin):

 Replying to [comment:2 igaztanaga]:
> I have some questions about the patch. If I understand LFS correctly:
>
> If _LARGEFILE64_SOURCE is defined, then we have new functions and types
 like open64/off64_t...
>
> If _FILE_OFFSET_BITS=64 then "open"/"off_t"... are 64 bit ready.
>
> Using O_LARGEFILE does not seem to guarantee compatibility as
 _FILE_OFFSET_BITS can be 32 and off_t would be 32 bits. We could open
 files bigger than 2GB but no seek or map them.
>
> Maybe the solution is to use xxx64 functions and types if
 _LARGEFILE64_SOURCE is defined and _FILE_OFFSET_BITS is not defined or
 it's equal to 32. Or am I missing something?

 After two more rereads of LSF I've finally got it right:
 To work with large files on x32 user only needs to define
 `_FILE_OFFSET_BITS=64`, so patch is incorrect.

 But maybe forcing x32 users to define `_FILE_OFFSET_BITS=64` will be a
 good idea:
 {{{
 #if !defined(__x86_64__) && !defined(__ppc64__) && \
  (!defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS==32)
 #error "To avoid errors while using big files define _FILE_OFFSET_BITS
 macro to 64 for your project."
 #endif
 }}}
 , otherwise this may lead to hard detectable errors.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8305#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC