Creating Memory Mappings
A memory mapping is established with the help of the mmap(2) function call. The function synopsis for it is as follows:
#include <sys/types.h> #include <sys/mman.h> void *mmap(void *addr,size_t len,int prot,int flags,int fd,off_t offset);
The argument addr is normally specified as a null pointer unless a specific mapping address must be used. When addr is null, the mmap(2) call returns the system-selected memory address.
When addr is not null, the argument flags influences the final result: The MAP_FIXED flag indicates that the specified address must be used, or an error indication is to be returned instead. When the flag MAP_FIXED is not present and addr is not null, the mmap(2) function will attempt to accommodate ...
Get Advanced UNIX Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.