1munmap(2) System Calls munmap(2)
2
3
4
6 munmap - unmap pages of memory
7
9 #include <sys/mman.h>
10
11 int munmap(void *addr, size_t len);
12
13
15 The munmap() function removes the mappings for pages in the range
16 [addr, addr + len), rounding the len argument up to the next multiple
17 of the page size as returned by sysconf(3C). If addr is not the address
18 of a mapping established by a prior call to mmap(2), the behavior is
19 undefined. After a successful call to munmap() and before any subse‐
20 quent mapping of the unmapped pages, further references to these pages
21 will result in the delivery of a SIGBUS or SIGSEGV signal to the
22 process.
23
24
25 The mmap(2) function often performs an implicit munmap().
26
28 Upon successful completion, munmap() returns 0; otherwise, it returns
29 −1 and sets errno to indicate an error.
30
32 The munmap() function will fail if:
33
34 EINVAL The addr argument is not a multiple of the page size as
35 returned by sysconf(3C); addresses in the range [addr, addr +
36 len) are outside the valid range for the address space of a
37 process; or the len argument has a value less than or equal
38 to 0.
39
40
42 See attributes(5) for descriptions of the following attributes:
43
44
45
46
47 ┌─────────────────────────────┬─────────────────────────────┐
48 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
49 ├─────────────────────────────┼─────────────────────────────┤
50 │Interface Stability │Standard │
51 └─────────────────────────────┴─────────────────────────────┘
52
54 mmap(2), sysconf(3C), attributes(5), standards(5)
55
56
57
58SunOS 5.11 5 Jan 1998 munmap(2)