From owner-freebsd-hackers Thu Jun 5 09:10:32 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id JAA21793 for hackers-outgoing; Thu, 5 Jun 1997 09:10:32 -0700 (PDT) Received: from watermarkgroup.com (lor.watermarkgroup.com [38.246.139.30]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id JAA21788 for ; Thu, 5 Jun 1997 09:10:29 -0700 (PDT) Received: by watermarkgroup.com (4.1/SMI-4.1) id AA13720; Thu, 5 Jun 97 12:09:52 EDT Date: Thu, 5 Jun 97 12:09:52 EDT From: luoqi@watermarkgroup.com (Luoqi Chen) Message-Id: <9706051609.AA13720@watermarkgroup.com> To: hackers@freebsd.org Subject: discrepancy in mmap(2) about MAP_ANON Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The mmap(2) man page: 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. So a file descriptor other than -1 can be used with MAP_ANON, and along with offset it names the mapped region (so it is possible to map the same region at another address). But in fact mmap() returns EINVAL. Here's the code in vm/vm_mmap.c, if (((flags & MAP_FIXED) && (addr & PAGE_MASK)) || (ssize_t) uap->len < 0 || ((flags & MAP_ANON) && uap->fd != -1)) return (EINVAL);