This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: mmap and MAP_FIXED
- From: Sean Daley <spdaley at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 24 Feb 2005 23:03:02 -0500
- Subject: Re: mmap and MAP_FIXED
- References: <421E6F46.1060005@stambulchik.net>
- Reply-to: Sean Daley <spdaley at gmail dot com>
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/