Subject: Re: Wine & NetBSD?
To: None <christos@tac.gw.com>
From: Chuck Cranor <chuck@xxx.research.att.com>
List: tech-kern
Date: 11/21/2001 10:07:38
In article <Gn4EGI.AK8@tac.nyc.ny.us>,
Christos Zoulas <christos@tac.gw.com> wrote:
>wine people: It works everywhere else, and it might break if we change it.
>Or because of older broken versions of mmap on linux, we don't want to
>make any changes.

actually, the wine people are already aware that it doesn't "work
everywhere else"...

if you look at their CVS 1.15 wine/library/port.c you'll see that 
Solaris totally ignores the "addr" param to mmap():

----------------------------
revision 1.15
date: 2001/09/07 18:46:14;  author: julliard;  state: Exp;  lines: +86 -0
Ulrich Weigand <weigand@immd1.informatik.uni-erlangen.de>
Emulate the behaviour of Linux mmap() on Solaris. Based on ideas and
sample code due to Erik Boasson <eboasson@signaal.nl> and John Wehle
<john@feith.com>.
----------------------------

from the source code:

/***********************************************************************
 *             solaris_try_mmap
 *
 * The purpose of this routine is to emulate the behaviour of
 * the Linux mmap() routine if a non-NULL address is passed,
 * but the MAP_FIXED flag is not set.  Linux in this case tries
 * to place the mapping at the specified address, *unless* the
 * range is already in use.  Solaris, however, completely ignores
 * the address argument in this case.
 *
 * As Wine code occasionally relies on the Linux behaviour, e.g. to
 * be able to map non-relocateable PE executables to their proper
 * start addresses, or to map the DOS memory to 0, this routine
 * emulates the Linux behaviour by checking whether the desired
 * address range is still available, and placing the mapping there
 * using MAP_FIXED if so.
 */

the function uses a vfork() ("to freeze all threads of the current process")
and then an mincore() to probe the address space.

as an aside: i think that mincore() isn't the right thing to use because
it probes for resident pages .. not memory mappings, but it prob. works 
most of the time.


chuck