1mlockall(3C)             Standard C Library Functions             mlockall(3C)
2
3
4

NAME

6       mlockall, munlockall - lock or unlock address space
7

SYNOPSIS

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

DESCRIPTION

18       The  mlockall() function locks in memory all pages mapped by an address
19       space.
20
21
22       The value of flags determines whether the pages to be locked are  those
23       currently mapped by the address space, those that will be mapped in the
24       future, or both:
25
26                MCL_CURRENT  Lock current mappings
27                MCL_FUTURE   Lock future mappings
28
29
30
31       If MCL_FUTURE is specified for mlockall(), mappings are locked as  they
32       are added to the address space (or replace existing mappings), provided
33       sufficient memory is available. Locking in this manner is  not  persis‐
34       tent across the exec family of functions (see exec(2)).
35
36
37       Mappings  locked  using  mlockall()  with  any option may be explicitly
38       unlocked with a munlock() call (see mlock(3C)).
39
40
41       The  munlockall() function removes address space  locks  and  locks  on
42       mappings in the address space.
43
44
45       All  conditions  and constraints on the use of locked memory that apply
46       to mlock(3C) also apply to mlockall().
47
48
49       Locks established with mlockall() are not inherited by a child  process
50       after a  fork(2) call, and are not nested.
51

RETURN VALUES

53       Upon successful completion, the  mlockall() and  munlockall() functions
54       return 0.  Otherwise, they return  −1 and set  errno  to  indicate  the
55       error.
56

ERRORS

58       The mlockall() and munlockall() functions will fail if:
59
60       EAGAIN    Some  or  all of the memory in the address space could not be
61                 locked due to  sufficient  resources.  This  error  condition
62                 applies to mlockall() only.
63
64
65       EINVAL    The flags argument contains values other than MCL_CURRENT and
66                 MCL_FUTURE.
67
68
69       EPERM     The {PRIV_PROC_LOCK_MEMORY} privilege is not asserted in  the
70                 effective set of the calling process.
71
72

ATTRIBUTES

74       See attributes(5) for descriptions of the following attributes:
75
76
77
78
79       ┌─────────────────────────────┬─────────────────────────────┐
80       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
81       ├─────────────────────────────┼─────────────────────────────┤
82       │Interface Stability          │Standard                     │
83       ├─────────────────────────────┼─────────────────────────────┤
84       │MT-Level                     │MT-Safe                      │
85       └─────────────────────────────┴─────────────────────────────┘
86

SEE ALSO

88       exec(2),    fork(2),   memcntl(2),   mmap(2),   plock(3C),   mlock(3C),
89       sysconf(3C), attributes(5), standards(5)
90
91
92
93SunOS 5.11                        22 Mar 2004                     mlockall(3C)
Impressum