From owner-freebsd-current@FreeBSD.ORG Sat Jun 18 00:59:38 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DE9B216A41C; Sat, 18 Jun 2005 00:59:38 +0000 (GMT) (envelope-from jd@ugcs.caltech.edu) Received: from regurgitate.ugcs.caltech.edu (regurgitate.ugcs.caltech.edu [131.215.176.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id B402C43D1F; Sat, 18 Jun 2005 00:59:38 +0000 (GMT) (envelope-from jd@ugcs.caltech.edu) Received: by regurgitate.ugcs.caltech.edu (Postfix, from userid 3640) id 392F3E816; Fri, 17 Jun 2005 17:59:38 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by regurgitate.ugcs.caltech.edu (Postfix) with ESMTP id 23694E815; Fri, 17 Jun 2005 17:59:38 -0700 (PDT) Date: Fri, 17 Jun 2005 17:59:38 -0700 (PDT) From: Jon Dama To: Peter Edwards In-Reply-To: <34cb7c8405061716327ca4c6d7@mail.gmail.com> Message-ID: References: <20050617180232.GA25818@freefall.freebsd.org> <42B31247.9010603@portaone.com> <34cb7c840506171121cd0437f@mail.gmail.com> <42B3189E.6030408@portaone.com> <34cb7c8405061716327ca4c6d7@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Peter Edwards , Maxim.Sobolev@portaone.com, current@freebsd.org Subject: Re: Towards a working "wine". [long] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jun 2005 00:59:39 -0000 My intuition says that mmap should ignore requests to map into the existing brk region but not reject requests that are merely between the existing brk region and the DS limit. Is this what happens now? -Jon On Sat, 18 Jun 2005, Peter Edwards wrote: > > >>... wine can call mmap(2) with MAP_FIXED and then if that fails try to > > >>call mmap(2) without it and deal with consequences. This will provide > > >>the same functionality but you won't get dependency on particular > > >>FreeBSD version to get MAP_TRYFIXED define. > > >> > > > > > > > > > Nope: MAP_FIXED will unconditionally overwrite any existing mapping at > > > the requested address. > > > > Hmm, the manpage doesn't mention anything of the effect. It only says: > > > > MAP_FIXED Do not permit the system to select a different address > > than the one specified. If the specified address can- > > not be used, mmap() will fail. If MAP_FIXED is speci- > > fied, addr must be a multiple of the pagesize. Use of > > this option is discouraged. > > > > Nothing about "overwriting any existing mapping". So that maybe > > implementation should be adjusted to match documentation, not another > > functionality be invented to workaround misbehaving implementation? > > Well, It's definitely behaved that way "traditionally" (where > traditionally means on any platform I've had to use mmap() on), and > the manpage is less than specific about what "cannot be used" means. > SUSv3 has this to say: > > > If a MAP_FIXED request is successful, the mapping established by mmap() > > replaces any previous mappings for the process' pages in the range > > [pa,pa+len). > > Again, it's very hazy, but it at least explicitly mentions that > MAP_FIXED may replace previous mappings. > > Really, MAP_TRYFIXED is just a hack to avoid the trouble the kernel > goes to in an effort to avoid mmap() and sbrk() from stomping on > eachother. It doesn't matter in Linux because sbrk() has much less > effect on things. (It's not a sytem call) I'd imagine it better to add > an explicit flag for this corner case than to change the behaviour of > existing applications. Apps using MAP_FIXED already are likely to be > quite sensitive to such a change. > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >