Best references:
1. Master from the Internet.
2. UNP V2 posix ipc chapter 12.
3. Linux man command.
Article 1: MMAP function Purpose
1. Map common files to the process memory space for memory ing Io.
2. Map special files to the process memory space for anonymous memory ing Io.
3. Map shm_open to open the POSIX shared memory zone to the memory space of the process, which can provide data sharing and IO among unrelated processes.
# Include <sys/Mman. h>
Void * MMAP (void * _ ADDR, size_t _ Len, int _ Prot, int _ flags, int _ FD, off_t _ offset ); // The offset value must be an integer multiple of sysconf (_ SC _page_size. The default value is 0. // The Len and offset values must be within the actual size range of the file referenced by FD. If not mapped, an error is reported during read/write operations.
Int munmap (void * _ ADDR, size_t _ Len );
Int mprotect (void * _ ADDR, size_t _ Len, int _ prot );
Int msync (void * _ ADDR, size_t _ Len, int _ flags );
It's easy to understand the 12 chapters of man and unpv2 ~~~ ^_^.