1MLOCKALL(3P)               POSIX Programmer's Manual              MLOCKALL(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       mlockall, munlockall — lock/unlock  the  address  space  of  a  process
13       (REALTIME)
14

SYNOPSIS

16       #include <sys/mman.h>
17
18       int mlockall(int flags);
19       int munlockall(void);
20

DESCRIPTION

22       The  mlockall()  function  shall  cause  all of the pages mapped by the
23       address space of a process to  be  memory-resident  until  unlocked  or
24       until the process exits or execs another process image. The flags argu‐
25       ment determines whether the pages to  be  locked  are  those  currently
26       mapped  by  the  address space of the process, those that are mapped in
27       the future, or both. The flags argument is constructed  from  the  bit‐
28       wise-inclusive  OR  of one or more of the following symbolic constants,
29       defined in <sys/mman.h>:
30
31       MCL_CURRENT Lock all of the pages currently  mapped  into  the  address
32                   space of the process.
33
34       MCL_FUTURE  Lock  all  of the pages that become mapped into the address
35                   space of the process in the future, when those mappings are
36                   established.
37
38       If  MCL_FUTURE  is  specified, and the automatic locking of future map‐
39       pings eventually causes the amount  of  locked  memory  to  exceed  the
40       amount of available physical memory or any other implementation-defined
41       limit, the behavior is implementation-defined. The manner in which  the
42       implementation  informs  the  application  of  these situations is also
43       implementation-defined.
44
45       The munlockall() function shall unlock all currently  mapped  pages  of
46       the address space of the process. Any pages that become mapped into the
47       address space of the process after a call to munlockall() shall not  be
48       locked,  unless  there  is an intervening call to mlockall() specifying
49       MCL_FUTURE or a subsequent call to mlockall()  specifying  MCL_CURRENT.
50       If  pages  mapped into the address space of the process are also mapped
51       into the address spaces of other processes and are locked by those pro‐
52       cesses,  the  locks  established  by the other processes shall be unaf‐
53       fected by a call by this process to munlockall().
54
55       Upon successful return from  the  mlockall()  function  that  specifies
56       MCL_CURRENT,  all  currently  mapped  pages of the address space of the
57       process shall be memory-resident and  locked.   Upon  return  from  the
58       munlockall()  function, all currently mapped pages of the address space
59       of the process shall be unlocked with respect to the address  space  of
60       the process.  The memory residency of unlocked pages is unspecified.
61
62       Appropriate  privileges are required to lock process memory with mlock‐
63       all().
64

RETURN VALUE

66       Upon successful completion, the  mlockall()  function  shall  return  a
67       value of zero. Otherwise, no additional memory shall be locked, and the
68       function shall return a value of -1  and  set  errno  to  indicate  the
69       error. The effect of failure of mlockall() on previously existing locks
70       in the address space is unspecified.
71
72       If it is supported by the  implementation,  the  munlockall()  function
73       shall  always  return  a  value  of zero. Otherwise, the function shall
74       return a value of -1 and set errno to indicate the error.
75

ERRORS

77       The mlockall() function shall fail if:
78
79       EAGAIN Some or all of the memory identified by the operation could  not
80              be locked when the call was made.
81
82       EINVAL The flags argument is zero, or includes unimplemented flags.
83
84       The mlockall() function may fail if:
85
86       ENOMEM Locking all of the pages currently mapped into the address space
87              of the process would exceed an implementation-defined  limit  on
88              the amount of memory that the process may lock.
89
90       EPERM  The calling process does not have appropriate privileges to per‐
91              form the requested operation.
92
93       The following sections are informative.
94

EXAMPLES

96       None.
97

APPLICATION USAGE

99       None.
100

RATIONALE

102       None.
103

FUTURE DIRECTIONS

105       None.
106

SEE ALSO

108       exec, exit(), fork(), mlock(), munmap()
109
110       The Base Definitions volume of POSIX.1‐2017, <sys_mman.h>
111
113       Portions of this text are reprinted and reproduced in  electronic  form
114       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
115       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
116       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
117       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
118       event of any discrepancy between this version and the original IEEE and
119       The Open Group Standard, the original IEEE and The Open Group  Standard
120       is  the  referee document. The original Standard can be obtained online
121       at http://www.opengroup.org/unix/online.html .
122
123       Any typographical or formatting errors that appear  in  this  page  are
124       most likely to have been introduced during the conversion of the source
125       files to man page format. To report such errors,  see  https://www.ker
126       nel.org/doc/man-pages/reporting_bugs.html .
127
128
129
130IEEE/The Open Group                  2017                         MLOCKALL(3P)
Impressum