Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <5c8adab705022420037a219a27@mail.gmail.com> Date: Thu, 24 Feb 2005 23:03:02 -0500 From: Sean Daley Reply-To: Sean Daley To: cygwin AT cygwin DOT com Subject: Re: mmap and MAP_FIXED In-Reply-To: <421E6F46.1060005@stambulchik.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <421E6F46 DOT 1060005 AT stambulchik DOT net> X-IsSubscribed: yes 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/