delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/19/10:15:14

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Mon, 19 Mar 2001 16:14:28 +0100
From: Corinna Vinschen <cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: ?mmap?
Message-ID: <20010319161428.G479@cygbert.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <3AB60CEC DOT 7FB88267 AT cs DOT technion DOT ac DOT il>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <3AB60CEC.7FB88267@cs.technion.ac.il>; from cwagner@cs.Technion.AC.IL on Mon, Mar 19, 2001 at 03:43:08PM +0200

On Mon, Mar 19, 2001 at 03:43:08PM +0200, Claus Wagner wrote:
> the second call returns the same address as the first call has returned.
> 
> There are some cases, which make a multiple mapping of the same piece of a file
> reasonable.
> 
> For example setting different protection attributes for two regions of one file:
> 
> ....
> ptr1 = mmap(fd,...,offset);
> ptr2 = mmap(fd,...,offset);
> ....
> mprotect(ptr1,PROT_READ,PAGE_SIZE);
> mprotect(ptr2,PROT_WRITE|PROT_READ,PAGE_SIZE);
> .....
> 
> 
> Anyway, I don't think, that the semantic of mmap should be like it is right now
> in your implementaion.

Please note that the mmap semantic of Win32 is very different to
the POSIX implementation. There's no way to get an exact match between
them. That's somewhat more difficult if you have a look into the
different implementations between 9x/ME on one hand and NT/W2K on
the other.

> Regards Claus Wagner.
> 
> ps: ... or should I read the POSIX standard :-)

Excerpt from SUSv2
(http://www.opengroup.org/onlinepubs/007908799/xsh/mmap.html):

=== SNIP ===
... The value of pa is an implementation-dependent function of
the parameter addr and the values of flags, further described
below. ...

... The mapping established by mmap() replaces any previous mappings
for those whole pages containing any part of the address space of
the process starting at pa and continuing for len bytes.

... If MAP_SHARED is specified, write references change the
underlying object. ...
=== SNAP ===

That's all given by the current implementation so I don't see a problem
here. If you're using the MAP_PRIVATE flag, you will not see that
behaviour.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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