From owner-freebsd-current@FreeBSD.ORG Sat Jun 18 11:43:57 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 B7DF616A41C for ; Sat, 18 Jun 2005 11:43:57 +0000 (GMT) (envelope-from peadar.edwards@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.192]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7519C43D55 for ; Sat, 18 Jun 2005 11:43:57 +0000 (GMT) (envelope-from peadar.edwards@gmail.com) Received: by zproxy.gmail.com with SMTP id 12so35980nzp for ; Sat, 18 Jun 2005 04:43:56 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=N3t9N0oPE4ecwxNV3EzU6rRGzPIN8Kgg2HehOdH0MrN2y3wyDqRGwInavl3Fue9C+TPV4SVt/MIf0TX/+Xz4zJdRs0uNuv33iIVEzVgCvfZ+gJtzvQgfBEX8tr+aC47o9kGDoPBdyWgcz+MAyDrtPdn9rXpCjOTzdSCcjAgO7C8= Received: by 10.36.18.8 with SMTP id 8mr1979861nzr; Sat, 18 Jun 2005 04:43:56 -0700 (PDT) Received: by 10.36.68.15 with HTTP; Sat, 18 Jun 2005 04:43:56 -0700 (PDT) Message-ID: <34cb7c840506180443586ac065@mail.gmail.com> Date: Sat, 18 Jun 2005 12:43:56 +0100 From: Peter Edwards To: Jon Dama In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050617180232.GA25818@freefall.freebsd.org> <42B31247.9010603@portaone.com> <34cb7c840506171121cd0437f@mail.gmail.com> <42B3189E.6030408@portaone.com> <34cb7c8405061716327ca4c6d7@mail.gmail.com> 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 Reply-To: Peter Edwards 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 11:43:57 -0000 On 6/18/05, Jon Dama wrote: > 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. >=20 > Is this what happens now? >=20 For the non-MAP_FIXED case, if the hint is in the data segment (ie, in the range [daddr, daddr + RLIMIT_DATA), _not_ [daddr, break)), or is NULL, it's adjusted to be just beyond the data segment. So, by default, mmap() starts looking for space after the data segment. So a low "hint", ie., one before the start of the data segment _wont_ be adjusted. The hint itself is used as the starting address for the search for enough address space to use: this search will return as soon as its found enough room in the processes memory map. Actually, there's a bit of a problem here: if you specify a low address before the data segment, you can actually get mmap to deliver memory inside the possible limits of the data segment, but after the current position of the "break". It's certainly confusing behaviour, but it might have some historical significance: Comments, anyone?