This is the mail archive of the 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 gcc precompiled headers

On Thu, Jul 03, 2003 at 11:47:28AM +0200, Corinna Vinschen wrote:
> On Wed, Jul 02, 2003 at 01:37:20PM -0700, Earl Chew wrote:
> > From the FreeBSD man page:
> > 
> >     If addr is non-zero, it is used as a hint to the system.  (As a
> >     convenience to the system, the actual address of the region may
> >     differ from the address supplied.) If addr is zero, an address will
> >     be selected by the system.

SUSv3 puts it like this:

  When MAP_FIXED is not set, the implementation uses addr in an
  implementation-defined manner to arrive at pa. The pa so chosen
  shall be an area of the address space that the implementation
  deems suitable for a mapping of len bytes to the file. [...]
  A non-zero value of addr is taken to be a suggestion of a process
  address near which the mapping should be placed.

`pa' is the result returned from mmap.  It's very important to emphasize
on "implementation-defined".  Again, if gcc relies on getting a map at
the same address without using MAP_FIXED, it's a bug in gcc. 

Therefore it would be "nice" to implement mmap64() as you suggested but
it will not exactly solve the problem.  Keep the following in mind:  On
9x as well as on NT systems, the returned address is the lowest address
possible to return inside the shared memory area.  That means, if you
realign addr to the next lower 64k boundary and use this in a call to
MapViewOfFileEx, that raises the chance to collide with a former still
active mapping.  I don't see that there's a really good solution.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

Unsubscribe info:
Problem reports:

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