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
21

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

102       None.
103

APPLICATION USAGE

105       None.
106

RATIONALE

108       None.
109

FUTURE DIRECTIONS

111       None.
112

SEE ALSO

114       exec(), exit(), fork(), mlock(), munmap(), the Base Definitions  volume
115       of IEEE Std 1003.1-2001, <sys/mman.h>
116
118       Portions  of  this text are reprinted and reproduced in electronic form
119       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
120       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
121       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
122       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
123       event of any discrepancy between this version and the original IEEE and
124       The  Open Group Standard, the original IEEE and The Open Group Standard
125       is the referee document. The original Standard can be  obtained  online
126       at http://www.opengroup.org/unix/online.html .
127
128
129
130IEEE/The Open Group                  2003                         MLOCKALL(3P)
Impressum