1.\" Copyright (c) 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 |
33.\" $FreeBSD: head/lib/libc/sys/mmap.2 57686 2000-03-02 09:14:21Z sheldonh $ |
34.\" 35.Dd May 11, 1995 36.Dt MMAP 2 37.Os BSD 4 38.Sh NAME 39.Nm mmap 40.Nd map files or devices into memory 41.Sh SYNOPSIS --- 86 unchanged lines hidden (view full) --- 128.Xr execve 2 129system calls. 130.It Dv MAP_PRIVATE 131Modifications are private. 132.It Dv MAP_SHARED 133Modifications are shared. 134.It Dv MAP_STACK 135This option is only available if your system has been compiled with |
136VM_STACK defined when compiling the kernel. 137This is the default for 138i386 only. 139Consider adding -DVM_STACK to COPTFLAGS in your /etc/make.conf 140to enable this option for other architechures. 141MAP_STACK implies |
142MAP_ANON, and 143.Fa offset 144of 0. 145.Fa fd 146must be -1 and 147.Fa prot 148must include at least PROT_READ and PROT_WRITE. This option creates 149a memory region that grows to at most --- 122 unchanged lines hidden (view full) --- 272.Xr munmap 2 , 273.Xr getpagesize 3 274.Sh BUGS 275.Ar len 276is limited to 2GB. Mmapping slightly more than 2GB doesn't work, but 277it is possible to map a window of size (filesize % 2GB) for file sizes 278of slightly less than 2G, 4GB, 6GB and 8GB. 279.Pp |
280The limit is imposed for a variety of reasons. 281Most of them have to do |
282with 283.Tn FreeBSD 284not wanting to use 64 bit offsets in the VM system due to |
285the extreme performance penalty. 286So |
287.Tn FreeBSD 288uses 32bit page indexes and 289this gives 290.Tn FreeBSD |
291a maximum of 8TB filesizes. 292It's actually bugs in |
293the filesystem code that causes the limit to be further restricted to 2941TB (loss of precision when doing blockno calculations). 295.Pp 296Another reason for the 2GB limit is that filesystem metadata can 297reside at negative offsets. 298.Pp 299We currently can only deal with page aligned file offsets. |