rte_eal_paging.h(3)
π rte_eal_paging.h(3) π
okay bestie, so this is a page from the Library Functions Manual β it's rte_eal_paging.h(3), literally the vibe manual for DPDK's page-and-mapping helpers. if you're out here mmap-ing things and want the OS-agnostic version, this is your girl. π§β¨
πΈ NAME πΈ
rte_eal_paging.h β the header that handles all your memory mapping, unmapping, page-sizing and page-locking dreams π
β¨ 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,
RTE_MAP_FORCE_ADDRESS_NOREPLACE = 1 << 4 }
π¦ 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
the memory protection flags, bestie. these are the little permission stickers you slap on your memory. π«Ά
Enumerator
RTE_PROT_READβ read access, as in, you may look. πRTE_PROT_WRITEβ write access, as in, you may touch. βοΈRTE_PROT_EXECUTEβ code execution, as in, you may run it. π₯
Definition at line 20 of file rte_eal_paging.h.
π enum rte_map_flags
the extra little flags for memory mapping. not required, but iconic. β¨
Enumerator
RTE_MAP_SHAREDβ changes you make to the mapped memory are visible to other processes. we're all sharing, no gatekeeping. πRTE_MAP_ANONYMOUSβ this mapping is not backed by a regular file. it's giving mystery, it's giving anonymous. πRTE_MAP_PRIVATEβ copy-on-write mapping, so your changes are invisible to other processes. what happens in your mapping stays in your mapping πRTE_MAP_FORCE_ADDRESSβ forces the mapping to the requested address. β οΈ use with caution, bestie, because to fulfill the request the implementation may remove all other mappings in the requested region. and lowkey? it is not required to do so, so mapping with this flag may straight up fail. πRTE_MAP_FORCE_ADDRESS_NOREPLACEβ also forces the mapping to the requested address, but it fails if a preexisting mapping collides with the request. no violence, just a clean no. β
Definition at line 27 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)
maps a portion of an opened file, or the page file, into memory. fr fr, it's the moment. πΈ
this function is basically POSIX mmap(3) with the common MAP_ANONYMOUS extension, except for the return value. don't get it twisted. π
Parameters
- requested_addr β the desired virtual address for the mapping. can be
NULLto just let the OS choose for you, main character energy, we trust the OS. π§ - size β size of the mapping, in bytes.
- prot β protection flags, a combination of
rte_mem_protvalues. - flags β additional mapping flags, a combination of
rte_map_flags. - fd β the mapped file descriptor. can be negative for anonymous mapping.
- offset β offset of the mapped region in
fd. must be0for anonymous mappings.
Returns
the mapped address, or NULL on failure β and when it fails, rte_errno gets set to the OS error. π
π __rte_internal int rte_mem_unmap (void * virt, size_t size)
the OS-independent implementation of POSIX munmap(3). that's it, that's the whole vibe. β¨
π __rte_internal size_t rte_mem_page_size (void )
get the system page size. and bestie, this one never fails β not once, not ever, it's built different. πͺ
Returns
the page size, in bytes. π
π __rte_internal int rte_mem_lock (const void * virt, size_t size)
locks all pages crossed by the address region into physical memory. no page left behind. π
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. so not a person, a robot, and honestly? it ate. π€β¨
ok that's literally the whole page, no notes π
signing off with the receipts: this was the DPDK manual, Version 25.11.3, and the page is rte_eal_paging.h(3). go map something slay, bestie ππ¦π
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms