map a region of a memory object
#include <sys/mman.h> void *mmap( void *addr, size_t len, int prot, int flags, int fildes, off_t off );
The mmap() function maps a region of the "memory object" specified by fildes into the calling process' address space. (The fildes was obtained by a previous call to the shm_open() function).
A region within the memory object beginning at offset off and continuing for len bytes is mapped into the caller's address space at the location returned by the mmap() function.
The offset off must be on a 4K page boundary. |
The addr parameter is an address in the caller's space where the mmap() function is to attempt to place the mapping. The only portable value for addr is zero, which lets the operating system determine the address of the mapping.
The prot parameter specifies the access capabilities to the memory region being mapped. The bits that can be combined in this field are defined in <sys/mman.h>, and are described in the section on that file in the Header Files chapter.
The flags parameter specifies further information about the handling of the mapped region. At least the following flag bits may be combined, as defined in <sys/mman.h>:
The address of the mapped memory region within the caller's space. On error, -1 is returned, and errno is set.
This implementation doesn't support the combination of accesses requested in the prot argument.
POSIX 1003.4
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
errno, mprotect(), munmap(), shm_open(), shm_unlink()
/etc/readme/technotes/shmem.txt