DPDK
20.08.0
|
#include <stdint.h>
#include <sys/mman.h>
#include <rte_compat.h>
Go to the source code of this file.
Enumerations | |
enum | rte_mem_prot { RTE_PROT_READ = 1 << 0, RTE_PROT_WRITE = 1 << 1, RTE_PROT_EXECUTE = 1 << 2 } |
enum | rte_map_flags |
Functions | |
__rte_internal void * | rte_mem_map (void *requested_addr, size_t size, int prot, int flags, int fd, size_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) |
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 20 of file rte_eal_paging.h.
enum rte_map_flags |
Additional flags for memory mapping.
Definition at line 27 of file rte_eal_paging.h.
__rte_internal void* rte_mem_map | ( | void * | requested_addr, |
size_t | size, | ||
int | prot, | ||
int | flags, | ||
int | fd, | ||
size_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.
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. |
__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.
__rte_internal int rte_mem_lock | ( | const void * | virt, |
size_t | size | ||
) |
Lock in physical memory all pages crossed by the address region.
virt | Base virtual address of the region. |
size | Size of the region. |