mman.h

Overview

Related Modules:

MEM

Description:

Declares structures and functions for performing memory operations, including memory mapping, remapping, unmapping, and attribute setting.

Since:

1.0

Version:

1.0

Summary

Macros

Macro Name and Value

Description

MAP_FAILED   ((void *) -1)

Indicates the return value of functions such as mmap() when the operation fails.

MAP_SHARED   0x01

Indicates the mapping attribute that the updates to the mapping are visible to other processes mapping the same file and are carried through to the underlying file. This macro is used as an input parameter passed to functions such as mmap().

MAP_PRIVATE   0x02

Indicates the mapping attribute that the updates to the mapping are not visible to other mapping processes and are not carried through to the underlying file. This macro is used as an input parameter passed to functions such as mmap().

MAP_FIXED   0x10

Indicates the mapping attribute that specifies the mapping as fixed mapping. This macro is used as an input parameter passed to functions such as mmap().

MAP_ANON   0x20

Indicates the mapping attribute that specifies the mapping as anonymous mapping without a specified file or device. This macro is used as an input parameter passed to functions such as mmap().

MAP_ANONYMOUS   MAP_ANON

Indicates the mapping attribute that specifies the mapping as anonymous mapping without a specified file or device. This macro is the synonym for MAP_ANON and is used as an input parameter passed to functions such as mmap().

PROT_NONE   0

Indicates that no permission is granted to the current process for accessing the mapping area. This macro is used as an input parameter passed to functions such as mmap().

PROT_READ   1

Indicates that the current process is granted the read permission on the mapping area. This macro is used as an input parameter passed to functions such as mmap().

PROT_WRITE   2

Indicates that the current process is granted the write permission on the mapping area. This macro is used as an input parameter passed to functions such as mmap().

PROT_EXEC   4

Indicates that the current process is granted the execute permission on the mapping area. This macro is used as an input parameter passed to functions such as mmap().

MREMAP_MAYMOVE   1

Indicates the remapping attribute that allows the mapping to be relocated to a new address. This macro is used as an input parameter passed to functions such as mremap().

MREMAP_FIXED   2

Indicates the remapping attribute that specifies the mapping as fixed mapping. This macro is used as an input parameter passed to functions such as mremap().

Functions

Function Name

Description

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

void  

Creates a mapping between the virtual address space of the calling process and a file or device.

munmap (void addr, size_t length)

int 

Removes all mappings for the specified virtual address space.

mprotect (void addr, size_t len, int prot)

int 

Sets protection attributes for the memory pages contained in the memory region starting from addr with the specified length.

mremap (void old_address, size_t old_size, size_t new_size, int flags,…)

void  

Remaps a virtual memory region.