Mmap function,
1. mmap system call
The man manual shows that:
1 void * mmap (void * addr, size_t length, int prot, int flags, 2 int fd, off_t offset );
Function: maps the file content to the virtual address space of the process. By reading and modifying the memory, you can read and modify the file without calling read and write;
Parameters:
Addr: Start address of the ing. If it is set to NULL, it is specified by the system;
Len: the length of the file mapped to the memory;
Prot: The expected memory protection flag. It cannot conflict with the file opening mode. PROT_EXEC, PROT_READ, PROT_WRITE, and so on;
Flags: specifies the type of the ing object, and whether the ing options and ing pages can be shared. MAP_SHARED, MAP_PRIVATE, etc;
Fd: file descriptor returned by open, representing the file to be mapped;
Offset: the offset of the file to start ing.
Returned value: when the operation is successful, mmap () returns the pointer to the ing zone. When a failure occurs, mmap () returns MAP_FAILED.
Mmap map:
2. un ing:
1 int munmap (void * addr, size_t length );