1mmap2(2)                      System Calls Manual                     mmap2(2)
2
3
4

NAME

6       mmap2 - map files or devices into memory
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <sys/mman.h>    /* Definition of MAP_* and PROT_* constants */
13       #include <sys/syscall.h> /* Definition of SYS_* constants */
14       #include <unistd.h>
15
16       void *syscall(SYS_mmap2, unsigned long addr, unsigned long length,
17                     unsigned long prot, unsigned long flags,
18                     unsigned long fd, unsigned long pgoffset);
19

DESCRIPTION

21       This  is  probably  not the system call that you are interested in; in‐
22       stead, see mmap(2), which describes the glibc wrapper function that in‐
23       vokes this system call.
24
25       The  mmap2() system call provides the same interface as mmap(2), except
26       that the final argument specifies the offset into the file in 4096-byte
27       units (instead of bytes, as is done by mmap(2)).  This enables applica‐
28       tions that use a 32-bit off_t to map large files (up to 2^44 bytes).
29

RETURN VALUE

31       On success, mmap2() returns a pointer to the mapped area.  On error, -1
32       is returned and errno is set to indicate the error.
33

ERRORS

35       EFAULT Problem with getting the data from user space.
36
37       EINVAL (Various platforms where the page size is not 4096 bytes.)  off‐
38              set * 4096 is not a multiple of the system page size.
39
40       mmap2() can also return any of the errors described in mmap(2).
41

VERSIONS

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

STANDARDS

53       Linux.
54

HISTORY

56       Linux 2.3.31.
57

SEE ALSO

59       getpagesize(2), mmap(2), mremap(2), msync(2), shm_open(3)
60
61
62
63Linux man-pages 6.05              2023-03-30                          mmap2(2)
Impressum