rte_eal_paging.h(3)

πŸ“¦
version 25.11.3 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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 NULL to 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_prot values.
  • 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 be 0 for 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