This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mmap and MAP_FIXED


Evgeny Stambulchik wrote:

> Christopher Faylor wrote:
> 
> > See:
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/mapviewoffileex.asp
> >
> > Pay particular attention to the description of lpBaseAddress.
> 
> Thanks! It doesn't explain, though, how mmap manages to avoid this 64k
> restriction when MAP_FIXED is NOT set (and why the same trick, whatever
> it is, can't be used with MAP_FIXED)?
> 
> Regards,
> 
> Evgeny
> 
Read the description to lpBaseAddress again and then read the
following comment from
cygwin's mmap code:
/* If a non-zero address is given, try mapping using the given address first.
   If it fails and flags is not MAP_FIXED, try again with NULL address. */

Also, the Linux man page for mmap pretty much sums it up as follows:

      The mmap function asks to map  length  bytes  starting  at
       offset offset from the file (or other object) specified by
       the file descriptor fd into memory, preferably at  address
       start.  This latter address is a hint only, and is usually
       specified as 0.  The actual  place  where  the  object  is
       mapped  is  returned by mmap.
...
       MAP_FIXED  Do not select a different address than the  one
       specified.   If the specified address cannot be
       used, mmap will fail.  If MAP_FIXED  is  speci-
       fied, start must be a multiple of the pagesize.
       Use of this option is discouraged.

Sean

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]