Print this page
6607 add default MAP_FILE symbol to sys/mman.h
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
   1 '\" te

   2 .\" Copyright 2013 OmniTI Computer Consulting, Inc. All Rights Reserved.
   3 .\" Copyright 1989 AT&T.  Copyright (c) 2009, Sun Microsystems, Inc.  All Rights Reserved.  Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   4 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   5 .\" http://www.opengroup.org/bookstore/.
   6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   7 .\"  This notice shall appear on any product containing this material.
   8 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  10 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  11 .TH MMAP 2 "April 9, 2016"
  12 .SH NAME
  13 mmap \- map pages of memory
  14 .SH SYNOPSIS
  15 .LP
  16 .nf
  17 #include <sys/mman.h>
  18 
  19 \fBvoid *\fR\fBmmap\fR(\fBvoid *\fR\fIaddr\fR, \fBsize_t\fR \fIlen\fR, \fBint\fR \fIprot\fR, \fBint\fR \fIflags\fR,
  20      \fBint\fR \fIfildes\fR, \fBoff_t\fR \fIoff\fR);
  21 .fi
  22 
  23 .SH DESCRIPTION
  24 .LP
  25 The \fBmmap()\fR function establishes a mapping between a process's address
  26 space and a file or shared memory object. The format of the call is as follows:
  27 .sp
  28 .LP
  29 \fIpa\fR = \fBmmap(\fR\fIaddr\fR\fB, \fR\fIlen\fR\fB, \fR\fIprot\fR\fB,
  30 \fR\fIflags\fR\fB, \fR\fIfildes\fR\fB, \fR\fIoff\fR\fB);\fR
  31 .sp


 194 .RE
 195 
 196 .sp
 197 .ne 2
 198 .na
 199 \fB\fBMAP_INITDATA\fR\fR
 200 .ad
 201 .RS 17n
 202 Map initialized data segment.
 203 .RE
 204 
 205 .sp
 206 .ne 2
 207 .na
 208 \fB\fBMAP_32BIT\fR\fR
 209 .ad
 210 .RS 17n
 211 Map to the lower 32 bits of address space.
 212 .RE
 213 












 214 .sp
 215 .LP
 216 The \fBMAP_SHARED\fR and \fBMAP_PRIVATE\fR options describe the disposition of
 217 write references to the underlying object. If \fBMAP_SHARED\fR is specified,
 218 write references will change the memory object. If \fBMAP_PRIVATE\fR is
 219 specified, the initial write reference will create a private copy of the memory
 220 object page and redirect the mapping to the copy. The private copy is not
 221 created until the first write; until then, other users who have the object
 222 mapped \fBMAP_SHARED\fR can change the object. Either \fBMAP_SHARED\fR or
 223 \fBMAP_PRIVATE\fR must be specified, but not both. The mapping type is retained
 224 across \fBfork\fR(2).
 225 .sp
 226 .LP
 227 When \fBMAP_FIXED\fR is set in the \fIflags\fR argument, the system is informed
 228 that the value of \fIpa\fR must be \fIaddr\fR, exactly. If \fBMAP_FIXED\fR is
 229 set, \fBmmap()\fR may return (\fBvoid *\fR)\(mi1 and set \fBerrno\fR to
 230 \fBEINVAL\fR.  If a \fBMAP_FIXED\fR request is successful, the mapping
 231 established by \fBmmap()\fR replaces any previous mappings for the process's
 232 pages in the range [\fIpa, pa + len\fR). The use of \fBMAP_FIXED\fR is
 233 discouraged, since it may prevent a system from making the most effective use


   1 '\" te
   2 .\" Copyright 2016 James S Blachly, MD. All Rights Reserved.
   3 .\" Copyright 2013 OmniTI Computer Consulting, Inc. All Rights Reserved.
   4 .\" Copyright 1989 AT&T.  Copyright (c) 2009, Sun Microsystems, Inc.  All Rights Reserved.  Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   6 .\" http://www.opengroup.org/bookstore/.
   7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   8 .\"  This notice shall appear on any product containing this material.
   9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  12 .TH MMAP 2 "August 29, 2016"
  13 .SH NAME
  14 mmap \- map pages of memory
  15 .SH SYNOPSIS
  16 .LP
  17 .nf
  18 #include <sys/mman.h>
  19 
  20 \fBvoid *\fR\fBmmap\fR(\fBvoid *\fR\fIaddr\fR, \fBsize_t\fR \fIlen\fR, \fBint\fR \fIprot\fR, \fBint\fR \fIflags\fR,
  21      \fBint\fR \fIfildes\fR, \fBoff_t\fR \fIoff\fR);
  22 .fi
  23 
  24 .SH DESCRIPTION
  25 .LP
  26 The \fBmmap()\fR function establishes a mapping between a process's address
  27 space and a file or shared memory object. The format of the call is as follows:
  28 .sp
  29 .LP
  30 \fIpa\fR = \fBmmap(\fR\fIaddr\fR\fB, \fR\fIlen\fR\fB, \fR\fIprot\fR\fB,
  31 \fR\fIflags\fR\fB, \fR\fIfildes\fR\fB, \fR\fIoff\fR\fB);\fR
  32 .sp


 195 .RE
 196 
 197 .sp
 198 .ne 2
 199 .na
 200 \fB\fBMAP_INITDATA\fR\fR
 201 .ad
 202 .RS 17n
 203 Map initialized data segment.
 204 .RE
 205 
 206 .sp
 207 .ne 2
 208 .na
 209 \fB\fBMAP_32BIT\fR\fR
 210 .ad
 211 .RS 17n
 212 Map to the lower 32 bits of address space.
 213 .RE
 214 
 215 .sp
 216 .ne 2
 217 .na
 218 \fB\fBMAP_FILE\fR\fR
 219 .ad
 220 .RS 17n
 221 Map a regular file. This is the default behavior;
 222 specifying this flag is not required. It is provided
 223 for compatibility with other systems and should not be
 224 included in new code.
 225 .RE
 226 
 227 .sp
 228 .LP
 229 The \fBMAP_SHARED\fR and \fBMAP_PRIVATE\fR options describe the disposition of
 230 write references to the underlying object. If \fBMAP_SHARED\fR is specified,
 231 write references will change the memory object. If \fBMAP_PRIVATE\fR is
 232 specified, the initial write reference will create a private copy of the memory
 233 object page and redirect the mapping to the copy. The private copy is not
 234 created until the first write; until then, other users who have the object
 235 mapped \fBMAP_SHARED\fR can change the object. Either \fBMAP_SHARED\fR or
 236 \fBMAP_PRIVATE\fR must be specified, but not both. The mapping type is retained
 237 across \fBfork\fR(2).
 238 .sp
 239 .LP
 240 When \fBMAP_FIXED\fR is set in the \fIflags\fR argument, the system is informed
 241 that the value of \fIpa\fR must be \fIaddr\fR, exactly. If \fBMAP_FIXED\fR is
 242 set, \fBmmap()\fR may return (\fBvoid *\fR)\(mi1 and set \fBerrno\fR to
 243 \fBEINVAL\fR.  If a \fBMAP_FIXED\fR request is successful, the mapping
 244 established by \fBmmap()\fR replaces any previous mappings for the process's
 245 pages in the range [\fIpa, pa + len\fR). The use of \fBMAP_FIXED\fR is
 246 discouraged, since it may prevent a system from making the most effective use