Boost C++ Libraries: Ticket #8305: Allow interprocess to work with big files on x32 POSIX systems https://svn.boost.org/trac10/ticket/8305 <p> This patch adds <code>O_LARGEFILE</code> to file open mode (if it is supported). </p> <p> Some info about defining <code>-D_FILE_OFFSET_BITS=64</code> on x32 POSIX systems shall be added to official documentation and maybe to <code>mapped_region</code> doxygen documentation. </p> <p> (patch was tested on x32 Linux on boost 1.53 and adopted for trunk version) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8305 Trac 1.4.3 Antony Polukhin Mon, 18 Mar 2013 15:13:28 GMT attachment set https://svn.boost.org/trac10/ticket/8305 https://svn.boost.org/trac10/ticket/8305 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">os_file_functions.hpp.patch</span> </li> </ul> Ticket Antony Polukhin Mon, 18 Mar 2013 15:23:51 GMT <link>https://svn.boost.org/trac10/ticket/8305#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8305#comment:1</guid> <description> <p> <a class="new ticket" href="https://svn.boost.org/trac10/ticket/7295" title="#7295: Bugs: mapped_region large file throw exception (new)">#7295</a> will be partially fixed by this </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Mon, 18 Mar 2013 22:27:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8305#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8305#comment:2</guid> <description> <p> I have some questions about the patch. If I understand LFS correctly: </p> <p> If _LARGEFILE64_SOURCE is defined, then we have new functions and types like open64/off64_t... </p> <p> If _FILE_OFFSET_BITS=64 then "open"/"off_t"... are 64 bit ready. </p> <p> 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. </p> <p> 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? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Tue, 19 Mar 2013 07:15:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8305#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8305#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8305#comment:2" title="Comment 2">igaztanaga</a>: </p> <blockquote class="citation"> <p> I have some questions about the patch. If I understand LFS correctly: </p> <p> If _LARGEFILE64_SOURCE is defined, then we have new functions and types like open64/off64_t... </p> <p> If _FILE_OFFSET_BITS=64 then "open"/"off_t"... are 64 bit ready. </p> <p> 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. </p> <p> 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? </p> </blockquote> <p> After two more rereads of LSF I've finally got it right: To work with large files on x32 user only needs to define <code>_FILE_OFFSET_BITS=64</code>, so patch is incorrect. </p> <p> But maybe forcing x32 users to define <code>_FILE_OFFSET_BITS=64</code> will be a good idea: </p> <pre class="wiki">#if !defined(__x86_64__) &amp;&amp; !defined(__ppc64__) &amp;&amp; \ (!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 </pre><p> , otherwise this may lead to hard detectable errors. </p> </description> <category>Ticket</category> </item> <item> <author>t.glaser@…</author> <pubDate>Tue, 11 Aug 2015 09:01:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8305#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8305#comment:4</guid> <description> <p> x32 does define <span class="underline">x86_64</span> though, you need to check for <span class="underline">ILP32</span> which is defined on x32 but not on i386 or amd64. </p> </description> <category>Ticket</category> </item> </channel> </rss>