summaryrefslogtreecommitdiff
path: root/usr/src/man/man3ucb/mctl.3ucb
blob: eb5ce6942dd4726ee51752a29a7ba604f006aa3c (plain)
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
230
231
232
233
234
'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" 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. 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. 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]
.TH MCTL 3UCB "Oct 30, 2007"
.SH NAME
mctl \- memory management control
.SH SYNOPSIS
.LP
.nf
\fB/usr/ucb/cc\fR [ \fIflag\fR ... ] \fIfile\fR ...
#include <sys/types.h>
#include <sys/mman.h>

\fBint\fR \fBmctl\fR(\fIaddr\fR, \fIlen\fR, \fIfunction\fR, \fIarg\fR)
\fBcaddr_t\fR \fIaddr\fR;
\fBsize_t\fR \fIlen\fR;
\fBint\fR \fIfunction\fR;
\fBint\fR \fIarg\fR;
.fi

.SH DESCRIPTION
.sp
.LP
\fBmctl()\fR applies a variety of control functions over pages identified by
the mappings established for the address range [\fIaddr, addr + len\fR). The
function to be performed is identified by the argument \fIfunction\fR. Valid
functions are defined in  \fB<mman.h>\fR as follows:
.sp
.ne 2
.na
\fB\fBMC_LOCK\fR\fR
.ad
.RS 15n
Lock the pages in the range in memory.  This function is used to support
\fBmlock()\fR. See \fBmlock\fR(3C) for semantics and usage. \fIarg\fR is
ignored.
.RE

.sp
.ne 2
.na
\fB\fBMC_LOCKAS\fR\fR
.ad
.RS 15n
Lock the pages in the address space in memory.  This function is used to
support \fBmlockall()\fR. See \fBmlockall\fR(3C) for semantics and usage.
\fIaddr\fR and \fIlen\fR are ignored. \fIarg\fR is an integer built from the
flags:
.sp
.ne 2
.na
\fB\fBMCL_CURRENT\fR\fR
.ad
.RS 15n
Lock current mappings
.RE

.sp
.ne 2
.na
\fB\fBMCL_FUTURE\fR\fR
.ad
.RS 15n
Lock future mappings
.RE

.RE

.sp
.ne 2
.na
\fB\fBMC_SYNC\fR\fR
.ad
.RS 15n
Synchronize the pages in the range with their backing storage. Optionally
invalidate cache copies. This function is used to support \fBmsync()\fR. See
\fBmsync\fR(3C) for semantics and usage. \fIarg\fR is used to represent the
\fIflags\fR argument to  \fBmsync()\fR. It is constructed from an OR of the
following values:
.sp
.ne 2
.na
\fB\fBMS_SYNC\fR\fR
.ad
.RS 17n
Synchronized write
.RE

.sp
.ne 2
.na
\fB\fBMS_ASYNC\fR\fR
.ad
.RS 17n
Return immediately
.RE

.sp
.ne 2
.na
\fB\fBMS_INVALIDATE\fR\fR
.ad
.RS 17n
Invalidate mappings
.RE

\fBMS_ASYNC\fR returns after all \fBI/O\fR operations are scheduled.
\fBMS_SYNC\fR does not return until all \fBI/O\fR operations are complete.
Specify exactly one of \fBMS_ASYNC\fR or \fBMS_SYNC\fR. \fBMS_INVALIDATE\fR
invalidates all cached copies of data from memory, requiring them to be
re-obtained from the object's permanent storage location upon the next
reference.
.RE

.sp
.ne 2
.na
\fB\fBMC_UNLOCK\fR\fR
.ad
.RS 15n
Unlock the pages in the range. This function is used to support
\fBmunlock()\fR. \fIarg\fR is ignored.
.RE

.sp
.ne 2
.na
\fB\fBMC_UNLOCKAS\fR\fR
.ad
.RS 15n
Remove address space memory lock, and locks on all current mappings. This
function is used to support  \fBmunlockall()\fR. \fIaddr\fR and \fIlen\fR must
have the value 0. \fIarg\fR is ignored.
.RE

.SH RETURN VALUES
.sp
.LP
\fBmctl()\fR returns \fB0\fR on success, \fB\(mi1\fR on failure.
.SH ERRORS
.sp
.LP
\fBmctl()\fR fails if:
.sp
.ne 2
.na
\fB\fBEAGAIN\fR\fR
.ad
.RS 10n
Some or all of the memory identified by the operation could not be locked due
to insufficient system resources.
.RE

.sp
.ne 2
.na
\fB\fBEBUSY\fR\fR
.ad
.RS 10n
\fBMS_INVALIDATE\fR was specified and one or more of the pages is locked in
memory.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
\fIaddr\fR is not a multiple of the page size as returned by
\fBgetpagesize()\fR.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
\fIaddr\fR and/or \fIlen\fR do not have the value 0 when \fBMC_LOCKAS\fR or
\fBMC_UNLOCKAS\fR are specified.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
\fIarg\fR is not valid for the function specified.
.RE

.sp
.ne 2
.na
\fB\fBEIO\fR\fR
.ad
.RS 10n
An I/O error occurred while reading from or writing to the file system.
.RE

.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
Addresses in the range [\fIaddr, addr + len\fR) are invalid for the address
space of a process, or specify one or more pages which are not mapped.
.RE

.sp
.ne 2
.na
\fB\fBEPERM\fR\fR
.ad
.RS 10n
The process's effective user \fBID\fR is not superuser and one of \fBMC_LOCK
MC_LOCKAS\fR, \fBMC_UNLOCK\fR, or \fBMC_UNLOCKAS\fR was specified.
.RE

.SH SEE ALSO
.sp
.LP
\fBmmap\fR(2), \fBmemcntl\fR(2), \fBgetpagesize\fR(3C), \fBmlock\fR(3C),
\fBmlockall\fR(3C), \fBmsync\fR(3C)
.SH NOTES
.sp
.LP
Use of these interfaces should be restricted to only applications written on
BSD platforms.  Use of these interfaces with any of the system libraries or in
multi-thread applications is unsupported.