Boost C++ Libraries: Ticket #5738: Default-constructed mapped_region address is not NULL https://svn.boost.org/trac10/ticket/5738 <p> On POSIX systems, the default-constructed mapped_region address is initialized with MAP_FAILED constant, which is not 0 (at least, on Linux). This contradicts documentation, which states that the initial address will be 0. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5738 Trac 1.4.3 Ion Gaztañaga Fri, 23 Dec 2011 13:48:56 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5738#comment:1 https://svn.boost.org/trac10/ticket/5738#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Thanks fixed in trunk at revision: 76118 </p> Ticket Andrey Semashev Fri, 23 Dec 2011 14:01:23 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/5738#comment:2 https://svn.boost.org/trac10/ticket/5738#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> I see you changed the documentation rather than implementation. I think it would be better to make initial address to be NULL on all platforms rather than some unspecified value. Sorry, I didn't make my intention clear in the ticket. I'll reopen it so that it doesn't get lost. </p> Ticket anonymous Sat, 24 Dec 2011 10:08:22 GMT <link>https://svn.boost.org/trac10/ticket/5738#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5738#comment:3</guid> <description> <p> I don't like the idea of making the address null on all platforms. In UNIX MAP_FAILED is not NULL and I don't think I should add a branch in the inline get_address to convert map_failed to null, confusing UNIX users. I've committed another change, creating an additional invalid_address() static function that returns a portable invalid address constant (0 in windows, MAP_FAILED in unix). Let me know if you think this can be enough to close the bug. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 24 Dec 2011 13:16:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5738#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5738#comment:4</guid> <description> <p> I didn't mean to add a branch to get_address. The idea was to process MAP_FAILED internally, when mmap is called, and always use NULL to indicate the invalid address to users. I think NULL is the commonly used value for pointers to indicate address validity, so there is no need to introduce another constant for this. In fact, I consider MAP_FAILED constant as a bad legacy of the mmap function interface. I'll try to prepare a patch to illustrate my suggestion. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 24 Dec 2011 14:06:15 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/5738 https://svn.boost.org/trac10/ticket/5738 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">mapped_region.patch</span> </li> </ul> <p> The patch that fixes initial address of mapped region. </p> Ticket Andrey Semashev Sat, 24 Dec 2011 14:08:08 GMT <link>https://svn.boost.org/trac10/ticket/5738#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5738#comment:5</guid> <description> <p> See the attached patch. I removed the invalid_address function as there is no need for it anymore. If you feel for it, you can leave it there, in which case it should always return NULL on all platforms. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Tue, 27 Dec 2011 09:39:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5738#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5738#comment:6</guid> <description> <p> Thanks for the patch, tested and committed (revision 76200). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Wed, 18 Jan 2012 20:51:33 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5738#comment:7 https://svn.boost.org/trac10/ticket/5738#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Merged to release branch. </p> Ticket