简体   繁体   中英

Identify flag in mmap function

 void *mmap(void *addr, size_t length, int prot, int flags,int fd, off_t offset);

I see call to mmap that prot=3 and flags=1 what does it mean about this buffer? ,How can I translate the flag that I see in man to number?

Is the user can read/write or read+write to this buffer?

This kind of question in C can be asked in two steps. First you need to read the manual to find the macros/constants you're looking for. I usually search in google for syscall <system call> (eg syscall mmap ). Then you have to find which header file defines them and the actual header file for your implementation.

For memory map:

The manual page can be found here: http://man7.org/linux/man-pages/man2/mmap.2.html

The header that defines the flags: https://unix.superglobalmegacorp.com/Net2/newsrc/sys/mman.h.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM