1mctl(3UCB)         SunOS/BSD Compatibility Library Functions        mctl(3UCB)
2
3
4

NAME

6       mctl - memory management control
7

SYNOPSIS

9       /usr/ucb/cc [ flag ... ] file ...
10       #include <sys/types.h>
11       #include <sys/mman.h>
12
13       int mctl(addr, len, function, arg)
14       caddr_t addr;
15       size_t len;
16       int function;
17       int arg;
18
19

DESCRIPTION

21       mctl()  applies a variety of control functions over pages identified by
22       the mappings established for the address range [addr, addr + len).  The
23       function  to be performed is identified by the argument function. Valid
24       functions are defined in  <mman.h> as follows:
25
26       MC_LOCK        Lock the pages in the range in memory.  This function is
27                      used to support mlock(). See mlock(3C) for semantics and
28                      usage. arg is ignored.
29
30
31       MC_LOCKAS      Lock the pages in the address  space  in  memory.   This
32                      function is used to support mlockall(). See mlockall(3C)
33                      for semantics and usage. addr and len are  ignored.  arg
34                      is an integer built from the flags:
35
36                      MCL_CURRENT    Lock current mappings
37
38
39                      MCL_FUTURE     Lock future mappings
40
41
42
43       MC_SYNC        Synchronize  the  pages  in the range with their backing
44                      storage. Optionally invalidate cache copies. This  func‐
45                      tion  is  used  to  support  msync().  See msync(3C) for
46                      semantics and usage. arg is used to represent the  flags
47                      argument  to   msync().  It is constructed from an OR of
48                      the following values:
49
50                      MS_SYNC          Synchronized write
51
52
53                      MS_ASYNC         Return immediately
54
55
56                      MS_INVALIDATE    Invalidate mappings
57
58                      MS_ASYNC returns after all I/O operations are scheduled.
59                      MS_SYNC  does  not  return  until all I/O operations are
60                      complete. Specify exactly one of  MS_ASYNC  or  MS_SYNC.
61                      MS_INVALIDATE invalidates all cached copies of data from
62                      memory,  requiring  them  to  be  re-obtained  from  the
63                      object's permanent storage location upon the next refer‐
64                      ence.
65
66
67       MC_UNLOCK      Unlock the pages in the range. This function is used  to
68                      support munlock(). arg is ignored.
69
70
71       MC_UNLOCKAS    Remove  address space memory lock, and locks on all cur‐
72                      rent  mappings.  This  function  is  used   to   support
73                      munlockall(). addr and len must have the value 0. arg is
74                      ignored.
75
76

RETURN VALUES

78       mctl() returns 0 on success, −1 on failure.
79

ERRORS

81       mctl() fails if:
82
83       EAGAIN    Some or all of the memory identified by the  operation  could
84                 not be locked due to insufficient system resources.
85
86
87       EBUSY     MS_INVALIDATE  was  specified and one or more of the pages is
88                 locked in memory.
89
90
91       EINVAL    addr is not a multiple of the page size as returned by getpa‐
92                 gesize().
93
94
95       EINVAL    addr  and/or  len  do  not have the value 0 when MC_LOCKAS or
96                 MC_UNLOCKAS are specified.
97
98
99       EINVAL    arg is not valid for the function specified.
100
101
102       EIO       An I/O error occurred while reading from or  writing  to  the
103                 file system.
104
105
106       ENOMEM    Addresses in the range [addr, addr + len) are invalid for the
107                 address space of a process, or  specify  one  or  more  pages
108                 which are not mapped.
109
110
111       EPERM     The  process's  effective user ID is not superuser and one of
112                 MC_LOCK MC_LOCKAS, MC_UNLOCK, or MC_UNLOCKAS was specified.
113
114

SEE ALSO

116       mmap(2),   memcntl(2),   getpagesize(3C),   mlock(3C),    mlockall(3C),
117       msync(3C)
118

NOTES

120       Use of these interfaces should be restricted to only applications writ‐
121       ten on BSD platforms.  Use of these interfaces with any of  the  system
122       libraries or in multi-thread applications is unsupported.
123
124
125
126SunOS 5.11                        30 Oct 2007                       mctl(3UCB)
Impressum