From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 5 00:27:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BACC106566C for ; Sun, 5 Jul 2009 00:27:50 +0000 (UTC) (envelope-from onemda@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 8F20E8FC0C for ; Sun, 5 Jul 2009 00:27:49 +0000 (UTC) (envelope-from onemda@gmail.com) Received: by fxm18 with SMTP id 18so2569071fxm.43 for ; Sat, 04 Jul 2009 17:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=LIbJ9KWBjzUcAwr0IX+7OCbGVzXgeq3HzYKZQ6h+90s=; b=YetFP5SIr5vevFLy59bjp0n4Y7PiPUosiDSKsYus8gkOzNmAdt6KYNMeThbYKXOZh/ ZODMRh+dny0fjJoru2q2I9Az6tbwxmc2/5B28f085x7hMRtP5Faiq/wO5bNcevsq/F2I Dx4f0/eXIhK6nFDbOqjF5HpttyXHhluXmPb70= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BuX/aig+dMLsVXQvY7qSMJw1YRHpzqJucsRi+17TT0cTED5SSNsVbfYmfnVC7S5Lz5 v4hiXxL94rAZb6Mb+T+vXioFacpNaLozrUToehCSO+zgK03QtWB1F4amLbAmFc15H8+j MUPFjXBlJIIvpqBzkXJecfa7pPGjFZQt7N5ro= MIME-Version: 1.0 Received: by 10.204.71.65 with SMTP id g1mr2932542bkj.27.1246753668616; Sat, 04 Jul 2009 17:27:48 -0700 (PDT) In-Reply-To: References: Date: Sun, 5 Jul 2009 00:27:48 +0000 Message-ID: <3a142e750907041727l6fac4b67m33973ec352664c6b@mail.gmail.com> From: "Paul B. Mahol" To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: mmap/munmap with zero length X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jul 2009 00:27:50 -0000 On 7/4/09, Alexander Best wrote: > i'm wondering why mmap and munmap behave differently when it comes to a > length > argument of zero. allocating memory with mmap for a zero length file returns > a > valid pointer to the mapped region. there is V flag for malloc.conf > > munmap however isn't able to remove a mapping with no length. > > wouldn't it be better to either forbid this in mmap or to allow it in > munmap? It wouldn't improve badly written program. -- Paul