---
title: "Generic kernel key-value maps"
---

> Documentation Index
> Fetch the complete documentation index at: https://example.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generic kernel key-value maps

The workhorses are `BPF_MAP_TYPE_ARRAY` (fast fixed-size index table), `BPF_MAP_TYPE_HASH` (arbitrary keys like 5-tuples or PIDs), and `LPM_TRIE` (longest-prefix CIDR routing).

Kernel hooks read and write via `bpf_map_lookup_elem()` and `bpf_map_update_elem()`, while user-space daemons iterate keys through the `bpf()` syscall or `mmap`.

## What changed

- Ephemeral stack → persistent kernel hash & array maps
- Isolated hooks → entry hook writes timestamp, exit reads it
- User-space agent → reads aggregated counters on demand

Source: https://example.com/ebpf-field-guide/core-architecture/maps-and-data/key-value/index.mdx
