- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Functions
Functions that manage memory mappping.
Evil

This header provides the meomry map functions mmap and munmap. More...

## Functions
void * | mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
| Creates or opens a named or unnamed file mapping object for a specified file and maps a view of a file mapping into the address space of a calling process. More...
int | munmap (void *addr, size_t len)
| Unmaps a mapped view of a file from the calling process's address space. More...

## Detailed Description

This header provides the meomry map functions mmap and munmap.

## Function Documentation

void* mmap | ( | void * | addr,
|  | size_t | len,
|  | int | prot,
|  | int | flags,
|  | int | fd,
|  | off_t | offset
| ) |  |

Creates or opens a named or unnamed file mapping object for a specified file and maps a view of a file mapping into the address space of a calling process.

Parameters

  addr | Unused
  len | Number of bytes to be mapped.
  prot | Protections.
  flags | Type of the mapped object.
  fd | File descriptor that describes the object to map.
  offset | Number of bytes from which to start the mapping.

Returns
  The starting address of the mapped view on success, -1 otherwise.

Create or open an unnamed file mapping object for a specified file described by the file descriptor `fd`. The number of bytes that are mapped is given by `len` and start after `offset` bytes. The parameter `addr` is unused.

The only type of the mapped object that is supported is `MAP_SHARED`. If another value if given, -1 is returned.

`prot` specifies the protection of the mapped region. If PROT_EXEC is used, it set the execute access. If PROT_READ is used, it sets the read access. If PROT_WRITE is used, it sets the write access.

If the map view of file can not be created, -1 is returned. If the mappping can not be done, -1 is returned.

If no error occured, the starting address of the mapped view is returned.

Conformity: None.

Supported OS: Windows Vista, Windows XP or Windows 2000 Professional.

Parameters

  addr | Unused
  len | Number of bytes to be mapped.
  prot | Protections.
  flags | Type of the mapped object.
  fd | File descriptor that describes the object to map.
  offset | Number of bytes from which to start the mapping.

Returns
  The starting address of the mapped view on success, -1 otherwise.

Create or open an unnamed file mapping object for a specified file described by the file descriptor `fd`. The number of bytes that are mapped is given by `len` and start after `offset` bytes. The parameter `addr` is unused.

The only type of the mapped object that is supported is `MAP_SHARED`. If another value if given, -1 is returned.

`prot` specifies the protection of the mapped region. If PROT_EXEC is used, it set the execute access. If PROT_READ is used, it sets the read access. If PROT_WRITE is used, it sets the write access.

If the map view of file can not be created, -1 is returned. If the mappping can not be done, -1 is returned.

If no error occured, the starting address of the mapped view is returned.

Conformity: None.

Referenced by eina_file_map_all(), and eina_file_map_new().

int munmap | ( | void * | addr,
|  | size_t | len
| ) |  |

Unmaps a mapped view of a file from the calling process's address space.

Parameters

  addr | Pointer to the base address.
  len | Unused.

Returns
  0 on success, -1 otherwise.

Unmaps a mapped view of a file from the calling process's address space. `addr` is the pointer to the base address. This value must be identical to the value returned by a previous call to mmap(). The parameter `len` is unsed.

Conformity: None.

Supported OS: Windows Vista, Windows XP or Windows 2000 Professional.

Parameters

  addr | Pointer to the base address.
  len | Unused.

Returns
  0 on success, -1 otherwise.

Unmaps a mapped view of a file from the calling process's address space. `addr` is the pointer to the base address. This value must be identical to the value returned by a previous call to mmap(). The parameter `len` is unsed.

Conformity: None.

Referenced by eina_file_map_free().