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

munmap.3p (4217B)


  1. '\" et
  2. .TH MUNMAP "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. munmap
  12. \(em unmap pages of memory
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <sys/mman.h>
  17. .P
  18. int munmap(void *\fIaddr\fP, size_t \fIlen\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fImunmap\fR()
  23. function shall remove any mappings for those entire pages containing
  24. any part of the address space of the process starting at
  25. .IR addr
  26. and continuing for
  27. .IR len
  28. bytes. Further references to these pages shall result in the
  29. generation of a SIGSEGV signal to the process.
  30. If there are no mappings in the specified address range, then
  31. \fImunmap\fR()
  32. has no effect.
  33. .P
  34. The implementation may require that
  35. .IR addr
  36. be a multiple of the page size as returned by
  37. \fIsysconf\fR().
  38. .P
  39. If a mapping to be removed was private, any modifications made in this
  40. address range shall be discarded.
  41. .P
  42. Any memory locks (see
  43. .IR "\fImlock\fR\^(\|)"
  44. and
  45. .IR "\fImlockall\fR\^(\|)")
  46. associated with this address range shall be removed, as if by an
  47. appropriate call to
  48. \fImunlock\fR().
  49. .P
  50. If a mapping removed from a typed memory object causes the
  51. corresponding address range of the memory pool to be inaccessible by
  52. any process in the system except through allocatable mappings (that is,
  53. mappings of typed memory objects opened with the
  54. POSIX_TYPED_MEM_MAP_ALLOCATABLE flag), then that range of the memory
  55. pool shall become deallocated and may become available to satisfy
  56. future typed memory allocation requests.
  57. .P
  58. A mapping removed from a typed memory object opened with the
  59. POSIX_TYPED_MEM_MAP_ALLOCATABLE flag shall not affect in any way the
  60. availability of that typed memory for allocation.
  61. .P
  62. The behavior of this function is unspecified if the mapping was not
  63. established by a call to
  64. \fImmap\fR().
  65. .SH "RETURN VALUE"
  66. Upon successful completion,
  67. \fImunmap\fR()
  68. shall return 0; otherwise, it shall return \-1 and set
  69. .IR errno
  70. to indicate the error.
  71. .SH ERRORS
  72. The
  73. \fImunmap\fR()
  74. function shall fail if:
  75. .TP
  76. .BR EINVAL
  77. Addresses in the range [\fIaddr\fP,\fIaddr\fP+\fIlen\fR) are outside
  78. the valid range for the address space of a process.
  79. .TP
  80. .BR EINVAL
  81. The
  82. .IR len
  83. argument is 0.
  84. .P
  85. The
  86. \fImunmap\fR()
  87. function may fail if:
  88. .TP
  89. .BR EINVAL
  90. The
  91. .IR addr
  92. argument is not a multiple of the page size as returned by
  93. \fIsysconf\fR().
  94. .LP
  95. .IR "The following sections are informative."
  96. .SH EXAMPLES
  97. None.
  98. .SH "APPLICATION USAGE"
  99. None.
  100. .SH RATIONALE
  101. The
  102. \fImunmap\fR()
  103. function corresponds to SVR4, just as the
  104. \fImmap\fR()
  105. function does.
  106. .P
  107. It is possible that an application has applied process memory locking
  108. to a region that contains shared memory. If this has occurred, the
  109. \fImunmap\fR()
  110. call ignores those locks and, if necessary, causes those locks to be
  111. removed.
  112. .P
  113. Most implementations require that
  114. .IR addr
  115. is a multiple of the page size as returned by
  116. \fIsysconf\fR().
  117. .SH "FUTURE DIRECTIONS"
  118. None.
  119. .SH "SEE ALSO"
  120. .IR "\fImlock\fR\^(\|)",
  121. .IR "\fImlockall\fR\^(\|)",
  122. .IR "\fImmap\fR\^(\|)",
  123. .IR "\fIposix_typed_mem_open\fR\^(\|)",
  124. .IR "\fIsysconf\fR\^(\|)"
  125. .P
  126. The Base Definitions volume of POSIX.1\(hy2017,
  127. .IR "\fB<sys_mman.h>\fP"
  128. .\"
  129. .SH COPYRIGHT
  130. Portions of this text are reprinted and reproduced in electronic form
  131. from IEEE Std 1003.1-2017, Standard for Information Technology
  132. -- Portable Operating System Interface (POSIX), The Open Group Base
  133. Specifications Issue 7, 2018 Edition,
  134. Copyright (C) 2018 by the Institute of
  135. Electrical and Electronics Engineers, Inc and The Open Group.
  136. In the event of any discrepancy between this version and the original IEEE and
  137. The Open Group Standard, the original IEEE and The Open Group Standard
  138. is the referee document. The original Standard can be obtained online at
  139. http://www.opengroup.org/unix/online.html .
  140. .PP
  141. Any typographical or formatting errors that appear
  142. in this page are most likely
  143. to have been introduced during the conversion of the source files to
  144. man page format. To report such errors, see
  145. https://www.kernel.org/doc/man-pages/reporting_bugs.html .