1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
|
'\" et
.TH sys_mman.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.\"
.SH NAME
sys/mman.h
\(em memory management declarations
.SH SYNOPSIS
.LP
.nf
#include <sys/mman.h>
.fi
.SH DESCRIPTION
The
.IR <sys/mman.h>
header shall define the following symbolic constants for use as
protection options:
.IP PROT_EXEC 14
Page can be executed.
.IP PROT_NONE 14
Page cannot be accessed.
.IP PROT_READ 14
Page can be read.
.IP PROT_WRITE 14
Page can be written.
.P
The
.IR <sys/mman.h>
header shall define the following symbolic constants for use as
flag options:
.IP MAP_FIXED 14
Interpret
.IR addr
exactly.
.IP MAP_PRIVATE 14
Changes are private.
.IP MAP_SHARED 14
Share changes.
.P
The
.IR <sys/mman.h>
header shall define the following symbolic constants for the
\fImsync\fR()
function:
.IP MS_ASYNC 14
Perform asynchronous writes.
.IP MS_INVALIDATE 14
Invalidate mappings.
.IP MS_SYNC 14
Perform synchronous writes.
.P
The
.IR <sys/mman.h>
header shall define the following symbolic constants for the
\fImlockall\fR()
function:
.IP MCL_CURRENT 14
Lock currently mapped pages.
.IP MCL_FUTURE 14
Lock pages that become mapped.
.P
The
.IR <sys/mman.h>
header shall define the symbolic constant MAP_FAILED which shall
have type
.BR "void *"
and shall be used to indicate a failure from the
\fImmap\fR()
function .
.P
If the Advisory Information option is supported, the
.IR <sys/mman.h>
header shall define symbolic constants for the
.IR advice
argument to the
\fIposix_madvise\fR()
function as follows:
.IP POSIX_MADV_DONTNEED 6
.br
The application expects that it will not access the specified range in
the near future.
.IP POSIX_MADV_NORMAL 6
.br
The application has no advice to give on its behavior with respect to
the specified range. It is the default characteristic if no advice is
given for a range of memory.
.IP POSIX_MADV_RANDOM 6
.br
The application expects to access the specified range in a random
order.
.IP POSIX_MADV_SEQUENTIAL 6
.br
The application expects to access the specified range sequentially from
lower addresses to higher addresses.
.IP POSIX_MADV_WILLNEED 6
.br
The application expects to access the specified range in the near
future.
.P
The
.IR <sys/mman.h>
header shall define the following symbolic constants for use as
flags for the
\fIposix_typed_mem_open\fR()
function:
.IP POSIX_TYPED_MEM_ALLOCATE 6
.br
Allocate on
\fImmap\fR().
.IP POSIX_TYPED_MEM_ALLOCATE_CONTIG 6
.br
Allocate contiguously on
\fImmap\fR().
.IP POSIX_TYPED_MEM_MAP_ALLOCATABLE 6
.br
Map on
\fImmap\fR(),
without affecting allocatability.
.P
The
.IR <sys/mman.h>
header shall define the
.BR mode_t ,
.BR off_t ,
and
.BR size_t
types as described in
.IR "\fB<sys_types.h>\fP".
.P
The
.IR <sys/mman.h>
header shall define the
.BR posix_typed_mem_info
structure, which shall include at least the following member:
.sp
.RS 4
.nf
size_t posix_tmi_length \fRMaximum length which may be allocated\fR
\fRfrom a typed memory object.\fR
.fi
.P
.RE
.P
The following shall be declared as functions and may also be defined as
macros. Function prototypes shall be provided.
.sp
.RS 4
.nf
int mlock(const void *, size_t);
int mlockall(int);
void *mmap(void *, size_t, int, int, int, off_t);
int mprotect(void *, size_t, int);
int msync(void *, size_t, int);
int munlock(const void *, size_t);
int munlockall(void);
int munmap(void *, size_t);
int posix_madvise(void *, size_t, int);
int posix_mem_offset(const void *restrict, size_t, off_t *restrict,
size_t *restrict, int *restrict);
int posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
int posix_typed_mem_open(const char *, int, int);
int shm_open(const char *, int, mode_t);
int shm_unlink(const char *);
.fi
.P
.RE
.LP
.IR "The following sections are informative."
.SH "APPLICATION USAGE"
None.
.SH RATIONALE
None.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IR "\fB<sys_types.h>\fP"
.P
The System Interfaces volume of POSIX.1\(hy2017,
.IR "\fImlock\fR\^(\|)",
.IR "\fImlockall\fR\^(\|)",
.IR "\fImmap\fR\^(\|)",
.IR "\fImprotect\fR\^(\|)",
.IR "\fImsync\fR\^(\|)",
.IR "\fImunmap\fR\^(\|)",
.IR "\fIposix_madvise\fR\^(\|)",
.IR "\fIposix_mem_offset\fR\^(\|)",
.IR "\fIposix_typed_mem_get_info\fR\^(\|)",
.IR "\fIposix_typed_mem_open\fR\^(\|)",
.IR "\fIshm_open\fR\^(\|)",
.IR "\fIshm_unlink\fR\^(\|)"
.\"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1-2017, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, 2018 Edition,
Copyright (C) 2018 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version 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 .
.PP
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|