Opened 10 years ago
Last modified 7 years ago
#8305 new Patches
Allow interprocess to work with big files on x32 POSIX systems
Reported by: | Antony Polukhin | Owned by: | Ion Gaztañaga |
---|---|---|---|
Milestone: | Boost 1.54.0 | Component: | interprocess |
Version: | Boost 1.53.0 | Severity: | Problem |
Keywords: | mmap _LARGEFILE64_SOURCE _FILE_OFFSET_BITS==64 | Cc: |
Description
This patch adds O_LARGEFILE
to file open mode (if it is supported).
Some info about defining -D_FILE_OFFSET_BITS=64
on x32 POSIX systems shall be added to official documentation and maybe to mapped_region
doxygen documentation.
(patch was tested on x32 Linux on boost 1.53 and adopted for trunk version)
Attachments (1)
Change History (5)
by , 10 years ago
Attachment: | os_file_functions.hpp.patch added |
---|
comment:1 by , 10 years ago
follow-up: 3 comment:2 by , 10 years ago
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?
comment:3 by , 10 years ago
Replying to 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.
comment:4 by , 7 years ago
x32 does define x86_64 though, you need to check for ILP32 which is defined on x32 but not on i386 or amd64.
#7295 will be partially fixed by this