VSTa manual pages  - MMAP (2)

NAME

mmap - manipulate process virtual address space

CONTENTS

Synopsis
Description

SYNOPSIS

#include <sys/mman.h>
int mmap(void *vaddr, ulong len, int prot, int flags, int fd, ulong offset);

DESCRIPTION

The mmap() system call manipulates the address space of a process. In general, len bytes of mapped space is created, and is mapped in at the specified vaddr. The vaddr can be (void *)0, and the OS will choose an address. MAP_FIXED, specified below, also affects address assignment.

The protection of the mapped space is controlled by the prot parameters, with the following bits defined:


#define PROT_EXEC (0x01) 

#define PROT_READ (0x02) 

#define PROT_WRITE (0x04) 

flags controls the contents of the memory space created by mmap(), and may contain the following options:


#define MAP_ANON (0x01) 

#define MAP_FILE (0x02) 

#define MAP_FIXED (0x04) 

#define MAP_PRIVATE (0x08) 

#define MAP_SHARED (0x10) 

#define MAP_PHYS (0x20) 

MAP_ANON specifies "anonymous" memory; this is memory which is filled on demand with an initial contents of zero.

MAP_FILE creates memory whose contents is initially filled from the file specified by the fd parameter. The contents is filled from offset bytes into the file.

MAP_FIXED requires that the new memory object be mapped exactly at the address specified by vaddr; otherwise, the request fails.

MAP_PRIVATE creates a memory objects in which any changes to the initial contents are not reflected in the object as viewed in any other address space.

MAP_SHARED is the opposite of MAP_PRIVATE; this option is not supported for writable memory segments in VSTa.

MAP_PHYS creates a view into physical memory; it is generally used by device drivers. In this case, vaddr is instead the physical address to map. The attached memory is always mapped in at an OS-chosen address.


MMAP (2)
Generated by manServer 1.06 from mmap.2 using man macros.