1MMAP2(2)                   Linux Programmer's Manual                  MMAP2(2)
2
3
4

NAME

6       mmap2 - map files or devices into memory
7

SYNOPSIS

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

DESCRIPTION

15       This  is  probably  not  the  system  call  that you are interested in;
16       instead, see mmap(2), which describes the glibc wrapper  function  that
17       invokes this 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

RETURN VALUE

25       On success, mmap2() returns a pointer to the mapped area.  On error, -1
26       is returned and errno is set appropriately.
27

ERRORS

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

VERSIONS

37       mmap2() is available since Linux 2.3.31.
38

CONFORMING TO

40       This system call is Linux-specific.
41

NOTES

43       On architectures where this system call is present,  the  glibc  mmap()
44       wrapper  function invokes this system call rather than the mmap(2) sys‐
45       tem call.
46
47       This system call does not exist on x86-64.
48
49       On ia64, the unit for offset is actually the system page  size,  rather
50       than 4096 bytes.
51

SEE ALSO

53       getpagesize(2), mmap(2), mremap(2), msync(2), shm_open(3)
54

COLOPHON

56       This  page  is  part of release 5.04 of the Linux man-pages project.  A
57       description of the project, information about reporting bugs,  and  the
58       latest     version     of     this    page,    can    be    found    at
59       https://www.kernel.org/doc/man-pages/.
60
61
62
63Linux                             2017-09-15                          MMAP2(2)
Impressum