---
name: "RTE_MAP_FORCE_ADDRESS"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_eal_paging.h"
---

# RTE\_MAP\_FORCE\_ADDRESS(3)

Part of [rte\_eal\_paging.h(3)](/rte_eal_paging.h/3.md).

## NAME

rte\_eal\_paging.h

## SYNOPSIS

`#include <stdint.h>`\
 `#include <rte_compat.h>`\

### Enumerations

enum **rte\_mem\_prot** { **RTE\_PROT\_READ** = 1 \<\< 0, **RTE\_PROT\_WRITE** = 1 \<\< 1, **RTE\_PROT\_EXECUTE** = 1 \<\< 2 }\
 enum **rte\_map\_flags** { **RTE\_MAP\_SHARED** = 1 \<\< 0, **RTE\_MAP\_ANONYMOUS** = 1 \<\< 1, **RTE\_MAP\_PRIVATE** = 1 \<\< 2, **RTE\_MAP\_FORCE\_ADDRESS** = 1 \<\< 3 }\

### Functions

\_\_rte\_internal void \* **rte\_mem\_map** (void \*requested\_addr, size\_t size, int prot, int flags, int fd, uint64\_t offset)\
 \_\_rte\_internal int **rte\_mem\_unmap** (void \*virt, size\_t size)\
 \_\_rte\_internal size\_t **rte\_mem\_page\_size** (void)\
 \_\_rte\_internal int **rte\_mem\_lock** (const void \*virt, size\_t size)\

## Enumeration Type Documentation

### enum rte\_mem\_prot

Memory protection flags.

**Enumerator**

- *RTE\_PROT\_READ*

  *Read access.*

- *RTE\_PROT\_WRITE*

  *Write access.*

- *RTE\_PROT\_EXECUTE*

  *Code execution.*

*Definition at line* **17** *of file* **rte\_eal\_paging.h***.*

### enum rte\_map\_flags

*Additional flags for memory mapping.*

**Enumerator**

- *RTE\_MAP\_SHARED*

  *Changes to the mapped memory are visible to other processes.*

- *RTE\_MAP\_ANONYMOUS*

  *Mapping is not backed by a regular file.*

- *RTE\_MAP\_PRIVATE*

  *Copy-on-write mapping, changes are invisible to other processes.*

- *RTE\_MAP\_FORCE\_ADDRESS*

  *Force mapping to the requested address. This flag should be used with caution, because to fulfill the request implementation may remove all other mappings in the requested region. However, it is not required to do so, thus mapping with this flag may fail.*

*Definition at line* **24** *of file* **rte\_eal\_paging.h***.*

## Function Documentation

### \_\_rte\_internal void \* rte\_mem\_map (void \* requested\_addr, size\_t size, int prot, int flags, int fd, uint64\_t offset)

*Map a portion of an opened file or the page file into memory.*

*This function is similar to POSIX mmap(3) with common MAP\_ANONYMOUS extension, except for the return value.*

**Parameters**

*requested\_addr Desired virtual address for mapping. Can be NULL to let OS choose.* \
 *size Size of the mapping in bytes.* \
 *prot Protection flags, a combination of rte\_mem\_prot values.* \
 *flags Additional mapping flags, a combination of rte\_map\_flags.* \
 *fd Mapped file descriptor. Can be negative for anonymous mapping.* \
 *offset Offset of the mapped region in fd. Must be 0 for anonymous mappings.*

**Returns**

*Mapped address or NULL on failure and rte\_errno is set to OS error.*

### \_\_rte\_internal int rte\_mem\_unmap (void \* virt, size\_t size)

*OS-independent implementation of POSIX munmap(3).*

### \_\_rte\_internal size\_t rte\_mem\_page\_size (void)

*Get system page size. This function never fails.*

**Returns**

*Page size in bytes.*

### \_\_rte\_internal int rte\_mem\_lock (const void \* virt, size\_t size)

*Lock in physical memory all pages crossed by the address region.*

**Parameters**

*virt Base virtual address of the region.* \
 *size Size of the region.*

**Returns**

*0 on success, negative on error.*

**See also**

**rte\_mem\_page\_size()** *to retrieve the page size.*

**rte\_mem\_lock\_page()** *to lock an entire single page.*

## Author

*Generated automatically by Doxygen for DPDK from the source code.*
