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

NAME

6       mlockall,  munlockall  -  lock/unlock  the  address  space of a process
7       (REALTIME)
8

SYNOPSIS

10       #include <sys/mman.h>
11
12       int mlockall(int flags);
13       int munlockall(void);
14
15

DESCRIPTION

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

RETURN VALUE

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

ERRORS

75       The mlockall() function shall fail if:
76
77       EAGAIN Some  or all of the memory identified by the operation could not
78              be locked when the call was made.
79
80       EINVAL The flags argument is zero, or includes unimplemented flags.
81
82
83       The mlockall() function may fail if:
84
85       ENOMEM Locking all of the pages currently mapped into the address space
86              of  the  process would exceed an implementation-defined limit on
87              the amount of memory that the process may lock.
88
89       EPERM  The calling process does not have the appropriate  privilege  to
90              perform the requested operation.
91
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() , the Base Definitions
109       volume of IEEE Std 1003.1-2001, <sys/mman.h>
110
112       Portions of this text are reprinted and reproduced in  electronic  form
113       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
114       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
115       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
116       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
117       event of any discrepancy between this version and the original IEEE and
118       The Open Group Standard, the original IEEE and The Open Group  Standard
119       is  the  referee document. The original Standard can be obtained online
120       at http://www.opengroup.org/unix/online.html .
121
122
123
124IEEE/The Open Group                  2003                          MLOCKALL(P)
Impressum