Debian Codegraph @

templates/man2/mlock.2.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:31+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "mlock"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-11"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "mlock, mlock2, munlock, mlockall, munlockall - lock and unlock memory"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "LIBRARY"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
61 #: opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "Standard C library (I<libc>,\\ I<-lc>)"
63 msgstr ""
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "SYNOPSIS"
70 msgstr ""
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid "B<#include E<lt>sys/mman.hE<gt>>\n"
77 msgstr ""
78
79 #. type: Plain text
80 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
81 #: opensuse-tumbleweed
82 #, no-wrap
83 msgid ""
84 "B<int mlock(>size_t size;\n"
85 "B< const void >I<addr>B<[>I<size>B<], size_t >I<size>B<);>\n"
86 "B<int mlock2(>size_t size;\n"
87 "B< const void >I<addr>B<[>I<size>B<], size_t >I<size>B<, unsigned int >I<flags>B<);>\n"
88 "B<int munlock(>size_t size;\n"
89 "B< const void >I<addr>B<[>I<size>B<], size_t >I<size>B<);>\n"
90 msgstr ""
91
92 #. type: Plain text
93 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
94 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
95 #, no-wrap
96 msgid ""
97 "B<int mlockall(int >I<flags>B<);>\n"
98 "B<int munlockall(void);>\n"
99 msgstr ""
100
101 #. type: SH
102 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
103 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
104 #, no-wrap
105 msgid "DESCRIPTION"
106 msgstr ""
107
108 #. type: Plain text
109 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
110 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
111 msgid ""
112 "B<mlock>(), B<mlock2>(), and B<mlockall>() lock part or all of the calling "
113 "process's virtual address space into RAM, preventing that memory from being "
114 "paged to the swap area."
115 msgstr ""
116
117 #. type: Plain text
118 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
119 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
120 msgid ""
121 "B<munlock>() and B<munlockall>() perform the converse operation, unlocking "
122 "part or all of the calling process's virtual address space, so that pages in "
123 "the specified virtual address range can be swapped out again if required by "
124 "the kernel memory manager."
125 msgstr ""
126
127 #. type: Plain text
128 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
129 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
130 msgid "Memory locking and unlocking are performed in units of whole pages."
131 msgstr ""
132
133 #. type: SS
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 #, no-wrap
137 msgid "mlock(), mlock2(), and munlock()"
138 msgstr ""
139
140 #. type: Plain text
141 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
142 #: opensuse-leap-16-1 opensuse-tumbleweed
143 msgid ""
144 "B<mlock>() locks pages in the address range starting at I<addr> and "
145 "continuing for I<size> bytes. All pages that contain a part of the "
146 "specified address range are guaranteed to be resident in RAM when the call "
147 "returns successfully; the pages are guaranteed to stay in RAM until later "
148 "unlocked."
149 msgstr ""
150
151 #. commit a8ca5d0ecbdde5cc3d7accacbd69968b0c98764e
152 #. commit de60f5f10c58d4f34b68622442c0e04180367f3f
153 #. commit b0f205c2a3082dd9081f9a94e50658c5fa906ff1
154 #. type: Plain text
155 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
156 #: opensuse-leap-16-1 opensuse-tumbleweed
157 msgid ""
158 "B<mlock2>() also locks pages in the specified range starting at I<addr> and "
159 "continuing for I<size> bytes. However, the state of the pages contained in "
160 "that range after the call returns successfully will depend on the value in "
161 "the I<flags> argument."
162 msgstr ""
163
164 #. type: Plain text
165 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
166 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
167 msgid "The I<flags> argument can be either 0 or the following constant:"
168 msgstr ""
169
170 #. type: TP
171 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
172 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
173 #, no-wrap
174 msgid "B<MLOCK_ONFAULT>"
175 msgstr ""
176
177 #. type: Plain text
178 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
179 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
180 msgid ""
181 "Lock pages that are currently resident and mark the entire range so that the "
182 "remaining nonresident pages are locked when they are populated by a page "
183 "fault."
184 msgstr ""
185
186 #. type: Plain text
187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
189 msgid "If I<flags> is 0, B<mlock2>() behaves exactly the same as B<mlock>()."
190 msgstr ""
191
192 #. type: Plain text
193 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
194 #: opensuse-leap-16-1 opensuse-tumbleweed
195 msgid ""
196 "B<munlock>() unlocks pages in the address range starting at I<addr> and "
197 "continuing for I<size> bytes. After this call, all pages that contain a "
198 "part of the specified memory range can be moved to external swap space again "
199 "by the kernel."
200 msgstr ""
201
202 #. type: SS
203 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
204 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
205 #, no-wrap
206 msgid "mlockall() and munlockall()"
207 msgstr ""
208
209 #. type: Plain text
210 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
211 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
212 msgid ""
213 "B<mlockall>() locks all pages mapped into the address space of the calling "
214 "process. This includes the pages of the code, data, and stack segment, as "
215 "well as shared libraries, user space kernel data, shared memory, and memory-"
216 "mapped files. All mapped pages are guaranteed to be resident in RAM when "
217 "the call returns successfully; the pages are guaranteed to stay in RAM until "
218 "later unlocked."
219 msgstr ""
220
221 #. type: Plain text
222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
224 msgid ""
225 "The I<flags> argument is constructed as the bitwise OR of one or more of the "
226 "following constants:"
227 msgstr ""
228
229 #. type: TP
230 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
231 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
232 #, no-wrap
233 msgid "B<MCL_CURRENT>"
234 msgstr ""
235
236 #. type: Plain text
237 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
238 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
239 msgid ""
240 "Lock all pages which are currently mapped into the address space of the "
241 "process."
242 msgstr ""
243
244 #. type: TP
245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
247 #, no-wrap
248 msgid "B<MCL_FUTURE>"
249 msgstr ""
250
251 #. type: Plain text
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 msgid ""
255 "Lock all pages which will become mapped into the address space of the "
256 "process in the future. These could be, for instance, new pages required by "
257 "a growing heap and stack as well as new memory-mapped files or shared memory "
258 "regions."
259 msgstr ""
260
261 #. type: TP
262 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
263 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
264 #, no-wrap
265 msgid "B<MCL_ONFAULT> (since Linux 4.4)"
266 msgstr ""
267
268 #. type: Plain text
269 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
270 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
271 msgid ""
272 "Used together with B<MCL_CURRENT>, B<MCL_FUTURE>, or both. Mark all current "
273 "(with B<MCL_CURRENT>) or future (with B<MCL_FUTURE>) mappings to lock "
274 "pages when they are faulted in. When used with B<MCL_CURRENT>, all present "
275 "pages are locked, but B<mlockall>() will not fault in non-present pages. "
276 "When used with B<MCL_FUTURE>, all future mappings will be marked to lock "
277 "pages when they are faulted in, but they will not be populated by the lock "
278 "when the mapping is created. B<MCL_ONFAULT> must be used with either "
279 "B<MCL_CURRENT> or B<MCL_FUTURE> or both."
280 msgstr ""
281
282 #. type: Plain text
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 msgid ""
286 "If B<MCL_FUTURE> has been specified, then a later system call (e.g., "
287 "B<mmap>(2), B<sbrk>(2), B<malloc>(3)), may fail if it would cause the number "
288 "of locked bytes to exceed the permitted maximum (see below). In the same "
289 "circumstances, stack growth may likewise fail: the kernel will deny stack "
290 "expansion and deliver a B<SIGSEGV> signal to the process."
291 msgstr ""
292
293 #. type: Plain text
294 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
295 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
296 msgid ""
297 "B<munlockall>() unlocks all pages mapped into the address space of the "
298 "calling process."
299 msgstr ""
300
301 #. type: SH
302 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
303 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
304 #, no-wrap
305 msgid "RETURN VALUE"
306 msgstr ""
307
308 #. type: Plain text
309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
311 msgid ""
312 "On success, these system calls return 0. On error, -1 is returned, I<errno> "
313 "is set to indicate the error, and no changes are made to any locks in the "
314 "address space of the process."
315 msgstr ""
316
317 #. type: SH
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 #, no-wrap
321 msgid "ERRORS"
322 msgstr ""
323
324 #. type: TP
325 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
326 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
327 #, no-wrap
328 msgid "B<EAGAIN>"
329 msgstr ""
330
331 #. type: Plain text
332 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
333 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
334 msgid ""
335 "(B<mlock>(), B<mlock2>(), and B<munlock>()) Some or all of the specified "
336 "address range could not be locked."
337 msgstr ""
338
339 #. type: TP
340 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
341 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
342 #, no-wrap
343 msgid "B<EINVAL>"
344 msgstr ""
345
346 #. type: Plain text
347 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
348 #: opensuse-leap-16-1 opensuse-tumbleweed
349 msgid ""
350 "(B<mlock>(), B<mlock2>(), and B<munlock>()) The result of the addition "
351 "I<addr>+I<size> was less than I<addr> (e.g., the addition may have resulted "
352 "in an overflow)."
353 msgstr ""
354
355 #. type: Plain text
356 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
357 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
358 msgid "(B<mlock2>()) Unknown I<flags> were specified."
359 msgstr ""
360
361 #. type: Plain text
362 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
363 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
364 msgid ""
365 "(B<mlockall>()) Unknown I<flags> were specified or B<MCL_ONFAULT> was "
366 "specified without either B<MCL_FUTURE> or B<MCL_CURRENT>."
367 msgstr ""
368
369 #. type: Plain text
370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
372 msgid "(Not on Linux) I<addr> was not a multiple of the page size."
373 msgstr ""
374
375 #. type: TP
376 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
377 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
378 #, no-wrap
379 msgid "B<ENOMEM>"
380 msgstr ""
381
382 #. type: Plain text
383 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
384 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
385 msgid ""
386 "(B<mlock>(), B<mlock2>(), and B<munlock>()) Some of the specified address "
387 "range does not correspond to mapped pages in the address space of the "
388 "process."
389 msgstr ""
390
391 #. I.e., the number of VMAs would exceed the 64kB maximum
392 #. type: Plain text
393 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
394 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
395 msgid ""
396 "(B<mlock>(), B<mlock2>(), and B<munlock>()) Locking or unlocking a region "
397 "would result in the total number of mappings with distinct attributes (e.g., "
398 "locked versus unlocked) exceeding the allowed maximum. (For example, "
399 "unlocking a range in the middle of a currently locked mapping would result "
400 "in three mappings: two locked mappings at each end and an unlocked mapping "
401 "in the middle.)"
402 msgstr ""
403
404 #. type: Plain text
405 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
406 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
407 msgid ""
408 "(Linux 2.6.9 and later) the caller had a nonzero B<RLIMIT_MEMLOCK> soft "
409 "resource limit, but tried to lock more memory than the limit permitted. "
410 "This limit is not enforced if the process is privileged (B<CAP_IPC_LOCK>)."
411 msgstr ""
412
413 #. In the case of mlock(), this check is somewhat buggy: it doesn't
414 #. take into account whether the to-be-locked range overlaps with
415 #. already locked pages. Thus, suppose we allocate
416 #. (num_physpages / 4 + 1) of memory, and lock those pages once using
417 #. mlock(), and then lock the *same* page range a second time.
418 #. In the case, the second mlock() call will fail, since the check
419 #. calculates that the process is trying to lock (num_physpages / 2 + 2)
420 #. pages, which of course is not true. (MTK, Nov 04, kernel 2.4.28)
421 #. type: Plain text
422 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
423 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
424 msgid ""
425 "(Linux 2.4 and earlier) the calling process tried to lock more than half of "
426 "RAM."
427 msgstr ""
428
429 #. type: TP
430 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
431 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
432 #, no-wrap
433 msgid "B<EPERM>"
434 msgstr ""
435
436 #. type: Plain text
437 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
438 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
439 msgid ""
440 "The caller is not privileged, but needs privilege (B<CAP_IPC_LOCK>) to "
441 "perform the requested operation."
442 msgstr ""
443
444 #. type: Plain text
445 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
446 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
447 msgid ""
448 "(B<munlockall>()) (Linux 2.6.8 and earlier) The caller was not privileged "
449 "(B<CAP_IPC_LOCK>)."
450 msgstr ""
451
452 #. type: SH
453 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
454 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
455 #, no-wrap
456 msgid "VERSIONS"
457 msgstr ""
458
459 #. type: SS
460 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
461 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
462 #, no-wrap
463 msgid "Linux"
464 msgstr ""
465
466 #. type: Plain text
467 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
468 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
469 msgid ""
470 "Under Linux, B<mlock>(), B<mlock2>(), and B<munlock>() automatically round "
471 "I<addr> down to the nearest page boundary. However, the POSIX.1 "
472 "specification of B<mlock>() and B<munlock>() allows an implementation to "
473 "require that I<addr> is page aligned, so portable applications should ensure "
474 "this."
475 msgstr ""
476
477 #. type: Plain text
478 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
479 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
480 msgid ""
481 "The I<VmLck> field of the Linux-specific I</proc/>pidI</status> file shows "
482 "how many kilobytes of memory the process with ID I<PID> has locked using "
483 "B<mlock>(), B<mlock2>(), B<mlockall>(), and B<mmap>(2) B<MAP_LOCKED>."
484 msgstr ""
485
486 #. type: SH
487 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
488 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
489 #, no-wrap
490 msgid "STANDARDS"
491 msgstr ""
492
493 #. type: TP
494 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
495 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
496 #, no-wrap
497 msgid "B<mlock>()"
498 msgstr ""
499
500 #. type: TQ
501 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
502 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
503 #, no-wrap
504 msgid "B<munlock>()"
505 msgstr ""
506
507 #. type: TQ
508 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
509 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
510 #, no-wrap
511 msgid "B<mlockall>()"
512 msgstr ""
513
514 #. type: TQ
515 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
516 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
517 #, no-wrap
518 msgid "B<munlockall>()"
519 msgstr ""
520
521 #. type: Plain text
522 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
523 #: opensuse-tumbleweed
524 msgid "POSIX.1-2024."
525 msgstr ""
526
527 #. type: TP
528 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
529 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
530 #, no-wrap
531 msgid "B<mlock2>()"
532 msgstr ""
533
534 #. type: Plain text
535 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
536 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
537 msgid "Linux."
538 msgstr ""
539
540 #. type: Plain text
541 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
542 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
543 msgid ""
544 "On POSIX systems on which B<mlock>() and B<munlock>() are available, "
545 "B<_POSIX_MEMLOCK_RANGE> is defined in I<E<lt>unistd.hE<gt>> and the number "
546 "of bytes in a page can be determined from the constant B<PAGESIZE> (if "
547 "defined) in I<E<lt>limits.hE<gt>> or by calling I<sysconf(_SC_PAGESIZE)>."
548 msgstr ""
549
550 #. POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
551 #. -1: unavailable, 0: ask using sysconf().
552 #. glibc defines it to 1.
553 #. type: Plain text
554 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
555 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
556 msgid ""
557 "On POSIX systems on which B<mlockall>() and B<munlockall>() are available, "
558 "B<_POSIX_MEMLOCK> is defined in I<E<lt>unistd.hE<gt>> to a value greater "
559 "than 0. (See also B<sysconf>(3).)"
560 msgstr ""
561
562 #. type: SH
563 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
564 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
565 #, no-wrap
566 msgid "HISTORY"
567 msgstr ""
568
569 #. type: Plain text
570 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
571 #: opensuse-tumbleweed
572 msgid "SVr4, POSIX.1-1996."
573 msgstr ""
574
575 #. type: Plain text
576 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
577 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
578 msgid "Linux 4.4, glibc 2.27."
579 msgstr ""
580
581 #. type: SH
582 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
583 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
584 #, no-wrap
585 msgid "NOTES"
586 msgstr ""
587
588 #. type: Plain text
589 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
590 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
591 msgid ""
592 "Memory locking has two main applications: real-time algorithms and high-"
593 "security data processing. Real-time applications require deterministic "
594 "timing, and, like scheduling, paging is one major cause of unexpected "
595 "program execution delays. Real-time applications will usually also switch "
596 "to a real-time scheduler with B<sched_setscheduler>(2). Cryptographic "
597 "security software often handles critical bytes like passwords or secret keys "
598 "as data structures. As a result of paging, these secrets could be "
599 "transferred onto a persistent swap store medium, where they might be "
600 "accessible to the enemy long after the security software has erased the "
601 "secrets in RAM and terminated. (But be aware that the suspend mode on "
602 "laptops and some desktop computers will save a copy of the system's RAM to "
603 "disk, regardless of memory locks.)"
604 msgstr ""
605
606 #. type: Plain text
607 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
608 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
609 msgid ""
610 "Real-time processes that are using B<mlockall>() to prevent delays on page "
611 "faults should reserve enough locked stack pages before entering the time-"
612 "critical section, so that no page fault can be caused by function calls. "
613 "This can be achieved by calling a function that allocates a sufficiently "
614 "large automatic variable (an array) and writes to the memory occupied by "
615 "this array in order to touch these stack pages. This way, enough pages will "
616 "be mapped for the stack and can be locked into RAM. The dummy writes ensure "
617 "that not even copy-on-write page faults can occur in the critical section."
618 msgstr ""
619
620 #. type: Plain text
621 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
622 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
623 msgid ""
624 "Memory locks are not inherited by a child created via B<fork>(2) and are "
625 "automatically removed (unlocked) during an B<execve>(2) or when the process "
626 "terminates. The B<mlockall>() B<MCL_FUTURE> and B<MCL_FUTURE | "
627 "MCL_ONFAULT> settings are not inherited by a child created via B<fork>(2) "
628 "and are cleared during an B<execve>(2)."
629 msgstr ""
630
631 #. type: Plain text
632 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
633 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
634 msgid ""
635 "Note that B<fork>(2) will prepare the address space for a copy-on-write "
636 "operation. The consequence is that any write access that follows will cause "
637 "a page fault that in turn may cause high latencies for a real-time process. "
638 "Therefore, it is crucial not to invoke B<fork>(2) after an B<mlockall>() "
639 "or B<mlock>() operation\\[em]not even from a thread which runs at a low "
640 "priority within a process which also has a thread running at elevated "
641 "priority."
642 msgstr ""
643
644 #. type: Plain text
645 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
646 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
647 msgid ""
648 "The memory lock on an address range is automatically removed if the address "
649 "range is unmapped via B<munmap>(2)."
650 msgstr ""
651
652 #. type: Plain text
653 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
654 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
655 msgid ""
656 "Memory locks do not stack, that is, pages which have been locked several "
657 "times by calls to B<mlock>(), B<mlock2>(), or B<mlockall>() will be "
658 "unlocked by a single call to B<munlock>() for the corresponding range or by "
659 "B<munlockall>(). Pages which are mapped to several locations or by several "
660 "processes stay locked into RAM as long as they are locked at least at one "
661 "location or by at least one process."
662 msgstr ""
663
664 #. type: Plain text
665 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
666 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
667 msgid ""
668 "If a call to B<mlockall>() which uses the B<MCL_FUTURE> flag is followed by "
669 "another call that does not specify this flag, the changes made by the "
670 "B<MCL_FUTURE> call will be lost."
671 msgstr ""
672
673 #. type: Plain text
674 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
675 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
676 msgid ""
677 "The B<mlock2>() B<MLOCK_ONFAULT> flag and the B<mlockall>() B<MCL_ONFAULT> "
678 "flag allow efficient memory locking for applications that deal with large "
679 "mappings where only a (small) portion of pages in the mapping are touched. "
680 "In such cases, locking all of the pages in a mapping would incur a "
681 "significant penalty for memory locking."
682 msgstr ""
683
684 #. type: SS
685 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
686 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
687 #, no-wrap
688 msgid "Limits and permissions"
689 msgstr ""
690
691 #. type: Plain text
692 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
693 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
694 msgid ""
695 "In Linux 2.6.8 and earlier, a process must be privileged (B<CAP_IPC_LOCK>) "
696 "in order to lock memory and the B<RLIMIT_MEMLOCK> soft resource limit "
697 "defines a limit on how much memory the process may lock."
698 msgstr ""
699
700 #. type: Plain text
701 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
702 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
703 msgid ""
704 "Since Linux 2.6.9, no limits are placed on the amount of memory that a "
705 "privileged process can lock and the B<RLIMIT_MEMLOCK> soft resource limit "
706 "instead defines a limit on how much memory an unprivileged process may lock."
707 msgstr ""
708
709 #. type: SH
710 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
711 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
712 #, no-wrap
713 msgid "BUGS"
714 msgstr ""
715
716 #. commit 0cf2f6f6dc605e587d2c1120f295934c77e810e8
717 #. type: Plain text
718 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
719 #: opensuse-leap-16-1 opensuse-tumbleweed
720 msgid ""
721 "In Linux 4.8 and earlier, a bug in the kernel's accounting of locked memory "
722 "for unprivileged processes (i.e., without B<CAP_IPC_LOCK>) meant that if "
723 "the region specified by I<addr> and I<size> overlapped an existing lock, "
724 "then the already locked bytes in the overlapping region were counted twice "
725 "when checking against the limit. Such double accounting could incorrectly "
726 "calculate a \"total locked memory\" value for the process that exceeded the "
727 "B<RLIMIT_MEMLOCK> limit, with the result that B<mlock>() and B<mlock2>() "
728 "would fail on requests that should have succeeded. This bug was fixed in "
729 "Linux 4.9."
730 msgstr ""
731
732 #. type: Plain text
733 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
734 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
735 msgid ""
736 "In Linux 2.4 series of kernels up to and including Linux 2.4.17, a bug "
737 "caused the B<mlockall>() B<MCL_FUTURE> flag to be inherited across a "
738 "B<fork>(2). This was rectified in Linux 2.4.18."
739 msgstr ""
740
741 #. See the following LKML thread:
742 #. http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
743 #. "Rationale for RLIMIT_MEMLOCK"
744 #. 23 Jan 2006
745 #. type: Plain text
746 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
747 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
748 msgid ""
749 "Since Linux 2.6.9, if a privileged process calls I<mlockall(MCL_FUTURE)> and "
750 "later drops privileges (loses the B<CAP_IPC_LOCK> capability by, for "
751 "example, setting its effective UID to a nonzero value), then subsequent "
752 "memory allocations (e.g., B<mmap>(2), B<brk>(2)) will fail if the "
753 "B<RLIMIT_MEMLOCK> resource limit is encountered."
754 msgstr ""
755
756 #. type: SH
757 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
758 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
759 #, no-wrap
760 msgid "SEE ALSO"
761 msgstr ""
762
763 #. type: Plain text
764 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
765 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
766 msgid ""
767 "B<mincore>(2), B<mmap>(2), B<setrlimit>(2), B<shmctl>(2), B<sysconf>(3), "
768 "B<proc>(5), B<capabilities>(7)"
769 msgstr ""
770
771 #. type: TH
772 #: debian-trixie
773 #, no-wrap
774 msgid "2024-05-02"
775 msgstr ""
776
777 #. type: TH
778 #: debian-trixie
779 #, no-wrap
780 msgid "Linux man-pages 6.9.1"
781 msgstr ""
782
783 #. type: Plain text
784 #: debian-trixie
785 msgid "Standard C library (I<libc>, I<-lc>)"
786 msgstr ""
787
788 #. type: Plain text
789 #: debian-trixie
790 #, no-wrap
791 msgid ""
792 "B<int mlock(const void >I<addr>B<[.>I<len>B<], size_t >I<len>B<);>\n"
793 "B<int mlock2(const void >I<addr>B<[.>I<len>B<], size_t >I<len>B<, unsigned int >I<flags>B<);>\n"
794 "B<int munlock(const void >I<addr>B<[.>I<len>B<], size_t >I<len>B<);>\n"
795 msgstr ""
796
797 #. type: Plain text
798 #: debian-trixie
799 msgid ""
800 "B<mlock>() locks pages in the address range starting at I<addr> and "
801 "continuing for I<len> bytes. All pages that contain a part of the specified "
802 "address range are guaranteed to be resident in RAM when the call returns "
803 "successfully; the pages are guaranteed to stay in RAM until later unlocked."
804 msgstr ""
805
806 #. commit a8ca5d0ecbdde5cc3d7accacbd69968b0c98764e
807 #. commit de60f5f10c58d4f34b68622442c0e04180367f3f
808 #. commit b0f205c2a3082dd9081f9a94e50658c5fa906ff1
809 #. type: Plain text
810 #: debian-trixie
811 msgid ""
812 "B<mlock2>() also locks pages in the specified range starting at I<addr> and "
813 "continuing for I<len> bytes. However, the state of the pages contained in "
814 "that range after the call returns successfully will depend on the value in "
815 "the I<flags> argument."
816 msgstr ""
817
818 #. type: Plain text
819 #: debian-trixie
820 msgid ""
821 "B<munlock>() unlocks pages in the address range starting at I<addr> and "
822 "continuing for I<len> bytes. After this call, all pages that contain a part "
823 "of the specified memory range can be moved to external swap space again by "
824 "the kernel."
825 msgstr ""
826
827 #. type: Plain text
828 #: debian-trixie
829 msgid ""
830 "(B<mlock>(), B<mlock2>(), and B<munlock>()) The result of the addition "
831 "I<addr>+I<len> was less than I<addr> (e.g., the addition may have resulted "
832 "in an overflow)."
833 msgstr ""
834
835 #. type: Plain text
836 #: debian-trixie fedora-44 fedora-rawhide
837 msgid "POSIX.1-2008."
838 msgstr ""
839
840 #. type: Plain text
841 #: debian-trixie fedora-44 fedora-rawhide
842 msgid "POSIX.1-2001, POSIX.1-2008, SVr4."
843 msgstr ""
844
845 #. commit 0cf2f6f6dc605e587d2c1120f295934c77e810e8
846 #. type: Plain text
847 #: debian-trixie
848 msgid ""
849 "In Linux 4.8 and earlier, a bug in the kernel's accounting of locked memory "
850 "for unprivileged processes (i.e., without B<CAP_IPC_LOCK>) meant that if "
851 "the region specified by I<addr> and I<len> overlapped an existing lock, then "
852 "the already locked bytes in the overlapping region were counted twice when "
853 "checking against the limit. Such double accounting could incorrectly "
854 "calculate a \"total locked memory\" value for the process that exceeded the "
855 "B<RLIMIT_MEMLOCK> limit, with the result that B<mlock>() and B<mlock2>() "
856 "would fail on requests that should have succeeded. This bug was fixed in "
857 "Linux 4.9."
858 msgstr ""
859
860 #. type: TH
861 #: fedora-44 fedora-rawhide
862 #, no-wrap
863 msgid "2024-11-17"
864 msgstr ""
865
866 #. type: TH
867 #: fedora-44 fedora-rawhide
868 #, no-wrap
869 msgid "Linux man-pages 6.13"
870 msgstr ""
871
872 #. type: Plain text
873 #: fedora-44 fedora-rawhide
874 #, no-wrap
875 msgid ""
876 "B<int mlock(const void >I<addr>B<[.>I<size>B<], size_t >I<size>B<);>\n"
877 "B<int mlock2(const void >I<addr>B<[.>I<size>B<], size_t >I<size>B<, unsigned int >I<flags>B<);>\n"
878 "B<int munlock(const void >I<addr>B<[.>I<size>B<], size_t >I<size>B<);>\n"
879 msgstr ""
880
881 #. type: TH
882 #: mageia-cauldron
883 #, no-wrap
884 msgid "Linux man-pages 6.17"
885 msgstr ""
886
887 #. type: TH
888 #: opensuse-leap-16-1 opensuse-tumbleweed
889 #, no-wrap
890 msgid "Linux man-pages (unreleased)"
891 msgstr ""