Deleted Added
sdiff udiff text old ( 57550 ) new ( 57686 )
full compact
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 57550 2000-02-28 04:10:35Z ps $
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. This is the default for
137i386 only. Consider adding -DVM_STACK to COPTFLAGS in your /etc/make.conf
138to enable this option for other architechures. MAP_STACK implies
139MAP_ANON, and
140.Fa offset
141of 0.
142.Fa fd
143must be -1 and
144.Fa prot
145must include at least PROT_READ and PROT_WRITE. This option creates
146a memory region that grows to at most

--- 122 unchanged lines hidden (view full) ---

269.Xr munmap 2 ,
270.Xr getpagesize 3
271.Sh BUGS
272.Ar len
273is limited to 2GB. Mmapping slightly more than 2GB doesn't work, but
274it is possible to map a window of size (filesize % 2GB) for file sizes
275of slightly less than 2G, 4GB, 6GB and 8GB.
276.Pp
277The limit is imposed for a variety of reasons. Most of them have to do
278with
279.Tn FreeBSD
280not wanting to use 64 bit offsets in the VM system due to
281the extreme performance penalty. So
282.Tn FreeBSD
283uses 32bit page indexes and
284this gives
285.Tn FreeBSD
286a maximum of 8TB filesizes. It's actually bugs in
287the filesystem code that causes the limit to be further restricted to
2881TB (loss of precision when doing blockno calculations).
289.Pp
290Another reason for the 2GB limit is that filesystem metadata can
291reside at negative offsets.
292.Pp
293We currently can only deal with page aligned file offsets.