Title: Question about mmap?

Source: Internet
Author: User
Title: Question about mmap? -- Linux general technology-Linux programming and kernel information. The following is a detailed description. At the beginning, I learned about linux programming. I don't know much about some basic issues.
I have read the original form of the mmap function void * mmap (void * addr, size_t length, int prot, int flags, int fd, off_t offset );
The rest are quite understandable, and the port and flags are a bit problematic.
The name of prot indicates the int type. How can I use PORT_RDONLY or another port in actual applications. I think this prot is similar to the linux File Permission. In this example, the port parameter is changed to the {0-7} numeric mode based on the File Permission. After compilation, the port parameter still passes, and it seems that the execution is fine. I want to know if this approach is correct.
There is also a flag, which also shows the int type. Can it also be replaced by numbers?
At last, mmap must have the root permission during compilation. I read an article saying that as long as the flag selects a value, it can be compiled with the common user permission. Is that true?
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.