1MMAP2(2) Linux Programmer's Manual MMAP2(2)
2
3
4
6 mmap2 - map files or devices into memory
7
9 #include <sys/mman.h>
10
11 void *mmap2(void *addr, size_t length, int prot,
12 int flags, int fd, off_t pgoffset);
13
15 This is probably not the system call you are interested; instead, see
16 mmap(2), which describes the glibc wrapper function that invokes this
17 system call.
18
19 The mmap2() system call provides the same interface as mmap(2), except
20 that the final argument specifies the offset into the file in 4096-byte
21 units (instead of bytes, as is done by mmap(2)). This enables applica‐
22 tions that use a 32-bit off_t to map large files (up to 2^44 bytes).
23
25 On success, mmap2() returns a pointer to the mapped area. On error -1
26 is returned and errno is set appropriately.
27
29 EFAULT Problem with getting the data from user space.
30
31 EINVAL (Various platforms where the page size is not 4096 bytes.) off‐
32 set * 4096 is not a multiple of the system page size.
33
34 mmap2() can also return any of the errors described in mmap(2).
35
37 mmap2() is available since Linux 2.3.31.
38
40 This system call is Linux-specific.
41
43 Nowadays, the glibc mmap() wrapper function invokes this system call
44 rather than the mmap(2) system call.
45
46 On ia64, the unit for offset is actually the system page size, rather
47 than 4096 bytes.
48
50 getpagesize(2), mmap(2), mremap(2), msync(2), shm_open(3)
51
53 This page is part of release 3.53 of the Linux man-pages project. A
54 description of the project, and information about reporting bugs, can
55 be found at http://www.kernel.org/doc/man-pages/.
56
57
58
59Linux 2012-04-16 MMAP2(2)