Mmap function,

Source: Internet
Author: User

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 );

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.