Subject: Re: MAP_ANON
To: Erik ?ngg?rd <>
From: Bang Jun-Young <>
List: tech-kern
Date: 03/18/2003 14:00:17
On Mon, Mar 17, 2003 at 02:58:46PM +0100, Erik ?ngg?rd wrote:
> Hi,
> man (2) mmap says:
>     MAP_ANON    Map anonymous memory not associated with any specific file.
>                 The file descriptor used for creating MAP_ANON regions is
>                 used only for naming, and may be specified as -1 if no name
>                 is associated with the region.
> But the ERRORS section of the same man page and the code in 
> sys/uvm/uvm_mmap.c suggest that the file descriptor must be -1 when 
> using MAP_ANON. Has this feature (creating a MAP_ANON region with an fd 
> used only for naming) been removed or has it not been implemented yet? 
> Or am I just confused?

The code was committed without enough description in the old VM in 1994.
FreeBSD vm_mmap.c (originated from the old VM) has no such code, and there's
no reason to not allow fd to be set to -1 for MAP_ANON case. IMO, it's a
bug in our uvm_mmap.c.


Bang Jun-Young <>