summaryrefslogtreecommitdiffstats
path: root/man0p/sys_mman.h.0p
blob: fa3ea2c6151196befdac448964f9dfc61399b838 (plain) (blame)
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "<sys/mman.h>" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <sys/mman.h> 
.SH NAME
sys/mman.h \- memory management declarations
.SH SYNOPSIS
.LP
\fB#include <sys/mman.h>\fP
.SH DESCRIPTION
.LP
The \fI<sys/mman.h>\fP header shall be supported if the implementation
supports at least one of the following
options:
.IP " *" 3
The Memory Mapped Files option 
.LP
.IP " *" 3
The Shared Memory Objects option 
.LP
.IP " *" 3
The Process Memory Locking option 
.LP
.IP " *" 3
The Memory Protection option 
.LP
.IP " *" 3
The Typed Memory Objects option 
.LP
.IP " *" 3
The Synchronized Input and Output option 
.LP
.IP " *" 3
The Advisory Information option 
.LP
.IP " *" 3
The Typed Memory Objects option 
.LP
.LP
If one or more of the Advisory Information, Memory Mapped Files, or
Shared Memory Objects options are supported, the following
protection options shall be defined: 
.TP 7
PROT_READ
Page can be read. 
.TP 7
PROT_WRITE
Page can be written. 
.TP 7
PROT_EXEC
Page can be executed. 
.TP 7
PROT_NONE
Page cannot be accessed. 
.sp
.LP
The following \fIflag\fP options shall be defined:
.TP 7
MAP_SHARED
Share changes. 
.TP 7
MAP_PRIVATE
Changes are private. 
.TP 7
MAP_FIXED
Interpret \fIaddr\fP exactly. 
.sp
.LP
The following flags shall be defined for \fImsync\fP():
.TP 7
MS_ASYNC
Perform asynchronous writes. 
.TP 7
MS_SYNC
Perform synchronous writes. 
.TP 7
MS_INVALIDATE
Invalidate mappings. 
.sp
.LP
The following symbolic constants shall be defined for the \fImlockall\fP()
function:
.TP 7
MCL_CURRENT
Lock currently mapped pages. 
.TP 7
MCL_FUTURE
Lock pages that become mapped. 
.sp
.LP
The symbolic constant MAP_FAILED shall be defined to indicate a failure
from the \fImmap\fP() function. 
.LP
If the Advisory Information and either the Memory Mapped Files or
Shared Memory Objects options are supported, values for
\fIadvice\fP used by \fIposix_madvise\fP() shall be defined as follows:
.TP 7
POSIX_MADV_NORMAL
.sp
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.
.TP 7
POSIX_MADV_SEQUENTIAL
.sp
The application expects to access the specified range sequentially
from lower addresses to higher addresses.
.TP 7
POSIX_MADV_RANDOM
.sp
The application expects to access the specified range in a random
order.
.TP 7
POSIX_MADV_WILLNEED
.sp
The application expects to access the specified range in the near
future.
.TP 7
POSIX_MADV_DONTNEED
.sp
The application expects that it will not access the specified range
in the near future.
.sp
.LP
The following flags shall be defined for \fIposix_typed_mem_open\fP():
.TP 7
POSIX_TYPED_MEM_ALLOCATE
.sp
Allocate on \fImmap\fP().
.TP 7
POSIX_TYPED_MEM_ALLOCATE_CONTIG
.sp
Allocate contiguously on \fImmap\fP().
.TP 7
POSIX_TYPED_MEM_MAP_ALLOCATABLE
.sp
Map on \fImmap\fP(), without affecting allocatability.
.sp
.LP
The \fBmode_t\fP, \fBoff_t\fP, and \fBsize_t\fP types shall be defined
as described in \fI<sys/types.h>\fP .
.LP
The \fI<sys/mman.h>\fP header shall define the structure \fBposix_typed_mem_info\fP,
which includes at least the
following member:
.sp
.RS
.nf

\fBsize_t  posix_tmi_length \fP Maximum length which may be allocated \fB
                         \fP from a typed memory object. \fB
\fP
.fi
.RE
.LP
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS
.nf

\fB
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 *);

\fP
.fi
.RE
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<sys/types.h>\fP , the System Interfaces volume of
IEEE\ Std\ 1003.1-2001, \fImlock\fP(), \fImlockall\fP(), \fImmap\fP(),
\fImprotect\fP(), \fImsync\fP(), \fImunlock\fP(), \fImunlockall\fP(),
\fImunmap\fP(), \fIposix_mem_offset\fP(),
\fIposix_typed_mem_get_info\fP(), \fIposix_typed_mem_open\fP(), \fIshm_open\fP(),
\fIshm_unlink\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 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 .