O'Reilly logo

Advanced UNIX Programming by Warren W. Gay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required