Ticket #8305: os_file_functions.hpp.patch

File os_file_functions.hpp.patch, 1.5 KB (added by Antony Polukhin, 10 years ago)
  • detail/os_file_functions.hpp

     
    2525#  include <boost/interprocess/detail/win32_api.hpp>
    2626#else
    2727#  ifdef BOOST_HAS_UNISTD_H
     28#     include <features.h> // _LARGEFILE64_SOURCE
    2829#     include <fcntl.h>
    2930#     include <unistd.h>
    3031#     include <sys/types.h>
     
    367368   bool           is_xsi;
    368369}  mapping_handle_t;
    369370
     371
     372// You need to define -D_FILE_OFFSET_BITS=64
     373// for accessing large files on x32.
     374#if defined(_LARGEFILE64_SOURCE) && defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS==64
     375typedef enum { read_only      = O_RDONLY | O_LARGEFILE
     376             , read_write     = O_RDWR | O_LARGEFILE
     377             , copy_on_write
     378             , read_private
     379             , invalid_mode   = 0xffff
     380             } mode_t;
     381#else
    370382typedef enum { read_only      = O_RDONLY
    371383             , read_write     = O_RDWR
    372384             , copy_on_write
    373385             , read_private
    374386             , invalid_mode   = 0xffff
    375387             } mode_t;
     388#endif
    376389
    377390typedef enum { file_begin     = SEEK_SET
    378391             , file_end       = SEEK_END
     
    444457   return ret;
    445458}
    446459
     460// You need to define -D_FILE_OFFSET_BITS=64
     461// for accessing large files on x32
     462// (requires _LARGEFILE64_SOURCE defined by system libraries).
    447463inline file_handle_t open_existing_file
    448464   (const char *name, mode_t mode, bool temporary = false)
    449465{