logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

mlock.3p (4627B)


  1. '\" et
  2. .TH MLOCK "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. mlock,
  12. munlock
  13. \(em lock or unlock a range of process address space
  14. (\fBREALTIME\fP)
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <sys/mman.h>
  19. .P
  20. int mlock(const void *\fIaddr\fP, size_t \fIlen\fP);
  21. int munlock(const void *\fIaddr\fP, size_t \fIlen\fP);
  22. .fi
  23. .SH DESCRIPTION
  24. The
  25. \fImlock\fR()
  26. function shall cause those whole pages containing any part of the
  27. address space of the process starting at address
  28. .IR addr
  29. and continuing for
  30. .IR len
  31. bytes to be memory-resident until unlocked or until the process exits
  32. or
  33. .IR exec s
  34. another process image. The implementation may require that
  35. .IR addr
  36. be a multiple of
  37. {PAGESIZE}.
  38. .P
  39. The
  40. \fImunlock\fR()
  41. function shall unlock those whole pages containing any part of the
  42. address space of the process starting at address
  43. .IR addr
  44. and continuing for
  45. .IR len
  46. bytes, regardless of how many times
  47. \fImlock\fR()
  48. has been called by the process for any of the pages in the specified
  49. range. The implementation may require that
  50. .IR addr
  51. be a multiple of
  52. {PAGESIZE}.
  53. .P
  54. If any of the pages in the range specified to a call to
  55. \fImunlock\fR()
  56. are also mapped into the address spaces of other processes, any locks
  57. established on those pages by another process are unaffected by the
  58. call of this process to
  59. \fImunlock\fR().
  60. If any of the pages in the range specified by a call to
  61. \fImunlock\fR()
  62. are also mapped into other portions of the address space of the calling
  63. process outside the range specified, any locks established on those
  64. pages via the other mappings are also unaffected by this call.
  65. .P
  66. Upon successful return from
  67. \fImlock\fR(),
  68. pages in the specified range shall be locked and memory-resident. Upon
  69. successful return from
  70. \fImunlock\fR(),
  71. pages in the specified range shall be unlocked with respect to the
  72. address space of the process. Memory residency of unlocked pages is
  73. unspecified.
  74. .P
  75. Appropriate privileges are required to lock process memory with
  76. \fImlock\fR().
  77. .SH "RETURN VALUE"
  78. Upon successful completion, the
  79. \fImlock\fR()
  80. and
  81. \fImunlock\fR()
  82. functions shall return a value of zero. Otherwise, no change is made to
  83. any locks in the address space of the process, and the function shall
  84. return a value of \-1 and set
  85. .IR errno
  86. to indicate the error.
  87. .SH ERRORS
  88. The
  89. \fImlock\fR()
  90. and
  91. \fImunlock\fR()
  92. functions shall fail if:
  93. .TP
  94. .BR ENOMEM
  95. Some or all of the address range specified by the
  96. .IR addr
  97. and
  98. .IR len
  99. arguments does not correspond to valid mapped pages in the address
  100. space of the process.
  101. .P
  102. The
  103. \fImlock\fR()
  104. function shall fail if:
  105. .TP
  106. .BR EAGAIN
  107. Some or all of the memory identified by the operation could not be
  108. locked when the call was made.
  109. .P
  110. The
  111. \fImlock\fR()
  112. and
  113. \fImunlock\fR()
  114. functions may fail if:
  115. .TP
  116. .BR EINVAL
  117. The
  118. .IR addr
  119. argument is not a multiple of
  120. {PAGESIZE}.
  121. .P
  122. The
  123. \fImlock\fR()
  124. function may fail if:
  125. .TP
  126. .BR ENOMEM
  127. Locking the pages mapped by the specified range would exceed an
  128. implementation-defined limit on the amount of memory that the process
  129. may lock.
  130. .TP
  131. .BR EPERM
  132. The calling process does not have appropriate privileges to perform
  133. the requested operation.
  134. .LP
  135. .IR "The following sections are informative."
  136. .SH EXAMPLES
  137. None.
  138. .SH "APPLICATION USAGE"
  139. None.
  140. .SH RATIONALE
  141. None.
  142. .SH "FUTURE DIRECTIONS"
  143. None.
  144. .SH "SEE ALSO"
  145. .IR "\fIexec\fR\^",
  146. .IR "\fIexit\fR\^(\|)",
  147. .IR "\fIfork\fR\^(\|)",
  148. .IR "\fImlockall\fR\^(\|)",
  149. .IR "\fImunmap\fR\^(\|)"
  150. .P
  151. The Base Definitions volume of POSIX.1\(hy2017,
  152. .IR "\fB<sys_mman.h>\fP"
  153. .\"
  154. .SH COPYRIGHT
  155. Portions of this text are reprinted and reproduced in electronic form
  156. from IEEE Std 1003.1-2017, Standard for Information Technology
  157. -- Portable Operating System Interface (POSIX), The Open Group Base
  158. Specifications Issue 7, 2018 Edition,
  159. Copyright (C) 2018 by the Institute of
  160. Electrical and Electronics Engineers, Inc and The Open Group.
  161. In the event of any discrepancy between this version and the original IEEE and
  162. The Open Group Standard, the original IEEE and The Open Group Standard
  163. is the referee document. The original Standard can be obtained online at
  164. http://www.opengroup.org/unix/online.html .
  165. .PP
  166. Any typographical or formatting errors that appear
  167. in this page are most likely
  168. to have been introduced during the conversion of the source files to
  169. man page format. To report such errors, see
  170. https://www.kernel.org/doc/man-pages/reporting_bugs.html .