mmap.2 (21907) | mmap.2 (23660) |
---|---|
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. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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.\" | 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. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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.1 (Berkeley) 6/4/93 | 32.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 |
33.\" | 33.\" |
34.Dd "June 4, 1993" | 34.Dd "May 11, 1995" |
35.Dt MMAP 2 36.Os BSD 4 37.Sh NAME 38.Nm mmap 39.Nd map files or devices into memory 40.Sh SYNOPSIS 41.Fd #include <sys/types.h> 42.Fd #include <sys/mman.h> --- 6 unchanged lines hidden (view full) --- 49.Fa addr 50and continuing for at most 51.Fa len 52bytes to be mapped from the object described by 53.Fa fd , 54starting at byte offset 55.Fa offset . 56If | 35.Dt MMAP 2 36.Os BSD 4 37.Sh NAME 38.Nm mmap 39.Nd map files or devices into memory 40.Sh SYNOPSIS 41.Fd #include <sys/types.h> 42.Fd #include <sys/mman.h> --- 6 unchanged lines hidden (view full) --- 49.Fa addr 50and continuing for at most 51.Fa len 52bytes to be mapped from the object described by 53.Fa fd , 54starting at byte offset 55.Fa offset . 56If |
57.Fa offset 58or | |
59.Fa len 60is not a multiple of the pagesize, the mapped region may extend past the 61specified range. | 57.Fa len 58is not a multiple of the pagesize, the mapped region may extend past the 59specified range. |
60Any such extension beyond the end of the mapped object will be zero-filled. |
|
62.Pp 63If 64.Fa addr 65is non-zero, it is used as a hint to the system. 66(As a convenience to the system, the actual address of the region may differ 67from the address supplied.) 68If 69.Fa addr --- 29 unchanged lines hidden (view full) --- 99.Em or Ns 'ing 100the following values: 101.Pp 102.Bl -tag -width MAP_FIXEDX 103.It Dv MAP_ANON 104Map anonymous memory not associated with any specific file. 105The file descriptor used for creating 106.Dv MAP_ANON | 61.Pp 62If 63.Fa addr 64is non-zero, it is used as a hint to the system. 65(As a convenience to the system, the actual address of the region may differ 66from the address supplied.) 67If 68.Fa addr --- 29 unchanged lines hidden (view full) --- 98.Em or Ns 'ing 99the following values: 100.Pp 101.Bl -tag -width MAP_FIXEDX 102.It Dv MAP_ANON 103Map anonymous memory not associated with any specific file. 104The file descriptor used for creating 105.Dv MAP_ANON |
107regions is used only for 108naming, and may be specified as \-1 if no name is associated with the 109region. | 106must be \-1. 107The 108.Fa offset 109parameter is ignored. |
110.\".It Dv MAP_FILE 111.\"Mapped from a regular file or character-special device memory. 112.It Dv MAP_FIXED 113Do not permit the system to select a different address than the one 114specified. 115If the specified address cannot be used, 116.Fn mmap 117will fail. --- 42 unchanged lines hidden (view full) --- 160The flag 161.Dv PROT_READ 162was specified as part of the 163.Fa prot 164parameter and 165.Fa fd 166was not open for reading. 167The flags | 110.\".It Dv MAP_FILE 111.\"Mapped from a regular file or character-special device memory. 112.It Dv MAP_FIXED 113Do not permit the system to select a different address than the one 114specified. 115If the specified address cannot be used, 116.Fn mmap 117will fail. --- 42 unchanged lines hidden (view full) --- 160The flag 161.Dv PROT_READ 162was specified as part of the 163.Fa prot 164parameter and 165.Fa fd 166was not open for reading. 167The flags |
168.Dv PROT_WRITE , | |
169.Dv MAP_SHARED 170and | 168.Dv MAP_SHARED 169and |
171.Dv MAP_WRITE 172were specified as part 173of the | 170.Dv PROT_WRITE 171were specified as part of the |
174.Fa flags 175and 176.Fa prot 177parameters and 178.Fa fd 179was not open for writing. 180.It Bq Er EBADF 181.Fa Fd 182is not a valid open file descriptor. 183.It Bq Er EINVAL 184.Dv MAP_FIXED 185was specified and the | 172.Fa flags 173and 174.Fa prot 175parameters and 176.Fa fd 177was not open for writing. 178.It Bq Er EBADF 179.Fa Fd 180is not a valid open file descriptor. 181.It Bq Er EINVAL 182.Dv MAP_FIXED 183was specified and the |
186.Fa addr | |
187parameter was not page aligned, or part of the desired address space 188resides out of the valid address space for a user process. 189.It Bq Er EINVAL 190.Fa Len 191was negative. 192.It Bq Er EINVAL 193.Dv MAP_ANON 194was specified and the --- 44 unchanged lines hidden --- | 184parameter was not page aligned, or part of the desired address space 185resides out of the valid address space for a user process. 186.It Bq Er EINVAL 187.Fa Len 188was negative. 189.It Bq Er EINVAL 190.Dv MAP_ANON 191was specified and the --- 44 unchanged lines hidden --- |