http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48004

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-07 
11:07:33 UTC ---
We can't simply use MAP_FIXED, as that will discard existing overlapping
mappings.

       MAP_FIXED
              Don't interpret addr as a hint: place  the  mapping  at  exactly
              that address.  addr must be a multiple of the page size.  If the
              memory region specified by addr and len overlaps  pages  of  any
              existing  mapping(s),  then  the overlapped part of the existing
              mapping(s) will be discarded.  If the specified  address  cannot
              be  used,  mmap()  will fail.  Because requiring a fixed address
              for a mapping is less portable, the use of this option  is  dis-
              couraged.

So we'd need to portably check for existing mappings in the range we want
to request.  I don't think that is desirable (if only from a performance
perspective).  The only way to do this that I can think of is parsing
/proc or installing a SIGSEGV/SIGBUS handler and poking every page ...

Reply via email to