delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/25/08:38:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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: <421F2A27.9030208@stambulchik.net>
Date: Fri, 25 Feb 2005 15:37:43 +0200
From: Evgeny Stambulchik <evgeny AT stambulchik DOT net>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: mmap and MAP_FIXED

Corinna Vinschen wrote:

> You shouldn't just use some arbitrary address and
> use MAP_FIXED with it, otherwise you're making invaild assumptions
> about the memory layout of your machine/os/application.

I know. It was just a test code to demo this 64K strangeness. In 
reality, I use addresses which have been previously returned by mmap 
(without MAP_FIXED).

> The reason that MAP_FAILED only works on 64K boundaries so far is,
> that I didn't handle this case.

I expected something like this ;-)

> Usually there are not many good reasons to use MAP_FIXED.

I know. Those good ones are memory debuggers/custom allocators. Quoting 
POSIX (http://www.opengroup.org/onlinepubs/009695399/functions/mmap.html):
"On the other hand, if the program specifies a fixed address mapping 
(which requires some implementation knowledge to determine a suitable 
address, if the function is supported at all), then the program is 
presumed to be successfully managing its own address space and should be 
trusted when it asks to map over existing data structures."

Which is exactly my case. I'm talking about libundo, which manages 
memory snapshotting: ftp://plasma-gate.weizmann.ac.il/pub/libundo/.

> However, I've checked in a patch which
> tries to handle MAP_FIXED on 4K boundaries, but only in the anonymous
> case.

Great! I'll give it a try once a new cygdll snapshot build is available.

Regards,

Evgeny

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019