Date: Thu, 5 Jun 97 12:09:52 EDT From: luoqi@watermarkgroup.com (Luoqi Chen) To: hackers@freebsd.org Subject: discrepancy in mmap(2) about MAP_ANON Message-ID: <9706051609.AA13720@watermarkgroup.com>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9706051609.AA13720>