bpf_list_push_front(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… bpf_list_push_front β€” add a node to the front of a BPF linked list

okay so bestie, welcome to the bpf_list_push_front(9) page. that (9) means it's a kernel API manual page, and today we're learning how to shove a node onto the front of a BPF linked list. yes, front. like cutting the line. iconic behavior honestly πŸŽ€


✨ SYNOPSIS ✨

__bpf_kfunc int bpf_list_push_front (struct bpf_list_head *head , struct
bpf_list_node *node , struct btf_struct_meta *meta , u64 off );

that's the whole signature, no cap. four args, one return, let's go πŸ¦‹


🫢 ARGUMENTS 🫢

  • head β€” the list head. the actual list you're messing with πŸ’–
  • node β€” the node you're inserting. the new main character πŸ‘‘
  • meta β€” struct metadata, and it's verifier-supplied. you don't touch this.
  • off β€” the offset of node within the containing object, also verifier-supplied. again, not your job πŸ™ˆ

🌸 DESCRIPTION 🌸

so what actually happens: node gets inserted at the front of head. that's it. that's the whole vibe.

BUT β€” and this is the part everyone asks about β€” the verifier rewrites meta and off for you. like literally rewrites them. BPF programs do not set them. so don't try, bestie, it's not gonna go how you think 😭


⭐ RETURN ⭐

  • 0 on success ✨ slay
  • -EINVAL if node is already linked πŸ’€ (it's already in a list, it cannot be in two, that's not how this works)

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, fr fr. this is the kernel file ./kernel/bpf/helpers.c crew:


mwah πŸ’œ this page lives in ./kernel/bpf, dated October 2026, and the manual entry is bpf_list_push_front(9). go push something to the front, you got this 🧚

πŸ“¦ where this page comes from