From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 5 18:03:44 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 EBF56106566B; Thu, 5 Nov 2009 18:03:44 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id B3A008FC08; Thu, 5 Nov 2009 18:03:44 +0000 (UTC) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 025032C2D34; Thu, 5 Nov 2009 12:03:44 -0600 (CST) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id px+9oMJIRvM3; Thu, 5 Nov 2009 12:03:36 -0600 (CST) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id EF32F2C2D3C; Thu, 5 Nov 2009 12:03:35 -0600 (CST) Message-ID: <4AF31377.60405@cs.rice.edu> Date: Thu, 05 Nov 2009 12:03:35 -0600 From: Alan Cox User-Agent: Thunderbird 2.0.0.23 (X11/20090822) MIME-Version: 1.0 To: Alexander Best References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: alc@freebsd.org, Ed Schouten , freebsd-hackers@freebsd.org Subject: Re: mmap(2) with MAP_ANON honouring offset although it shouldn't 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: Thu, 05 Nov 2009 18:03:45 -0000 Alexander Best wrote: > Alan Cox schrieb am 2009-11-04: > >> Ed Schouten wrote: >> >>> * Alan Cox wrote: >>> > > >> For what it's worth, I believe that Solaris does the exact opposite. >> >>>> They provide MAP_ANONYMOUS for compatibility. It seems like a good >>>> idea for us to do the same. >>>> > > > >>> Something like this? >>> > > >>> Index: mman.h >>> =================================================================== >>> --- mman.h (revision 198919) >>> +++ mman.h (working copy) >>> @@ -82,6 +82,9 @@ >>> */ >>> #define MAP_FILE 0x0000 /* map from file (default) */ >>> #define MAP_ANON 0x1000 /* allocated from memory, >>> swap space */ >>> +#ifndef _KERNEL >>> +#define MAP_ANONYMOUS MAP_ANON /* For compatibility. */ >>> +#endif /* !_KERNEL */ >>> /* >>> * Extended flags >>> > > > > >> Yes. If no one objects in the next day or so, then please commit >> this change. >> > > >> Alan >> > > should this compatibility addition be documented in the mmap(2) manual? > > I don't have a strong opinion one way or the other, but I would lean toward "yes". That said, Solaris doesn't. > any thoughts on the previous change request so mmap fails with MAP_ANON and > pos=0? > > Unfortunately, no. My FreeBSD time for the last few days has been spent looking into some anomalies in wiring memory and writing breakpoints. Alan