bpf_refcount_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… bpf_refcount_acquire β€” ngl this one's a little kernel-API glow-up

okay so bestie, welcome to bpf_refcount_acquire(9), from your friendly neighbourhood Kernel API Manual 🫢 this is the page where a non-owning little local kptr gets promoted to a whole owning reference, and honestly? it's giving main character energy ✨


✨ NAME ✨

bpf_refcount_acquire β€” turn a local kptr into an owning reference πŸ’–

like, literally the whole job. no notes.


🌸 SYNOPSIS 🌸

__bpf_kfunc void * bpf_refcount_acquire (void *p__refcounted_kptr ,
       struct btf_struct_meta *meta );

yes that's the signature, character for character, don't come for me πŸ™ˆ


πŸŽ€ ARGUMENTS πŸŽ€

  • p__refcounted_kptr β€” a non-owning local kptr. not an owner yet. just vibing. lowkey a spectator πŸ¦‹
  • meta β€” verifier-supplied struct metadata. the verifier hands this over, it's not your problem πŸ’…

⭐ DESCRIPTION ⭐

So here's the tea β˜•: this increments the refcount for p__refcounted_kptr. that's it, that's the move. it turns that non-owning local kptr situation into an owning reference, slay πŸ‘‘

and about meta β€” the verifier rewrites meta. BPF programs do not set it. periodt. so don't be out here trying to set it yourself, that's not your lane, the verifier's got it fr fr 🧚


πŸ”₯ RETURN πŸ”₯

An owning reference to p__refcounted_kptr πŸ’– β€” or NULL on failure 😭 (yes, failure is a real possibility, check your return value bestie, no cap).


🌈 SEE ALSO 🌈

okay this list is long long, but every single one of them matters, so buckle up buttercup, i'm not skipping a single one 🫢

Kernel file ./kernel/bpf/helpers.c


πŸ’– reminder bestie: meta is verifier-supplied. you do not set it. i said what i said.

and that's the whole page!! tysm for reading, ily 🫢 this lil manual came from the kernel file path ./kernel/bpf and it's dated October 2026 β€” so yeah, mark your calendars, future vibes only, bye bestie! πŸŽ€βœ¨πŸ‘‘

πŸ“¦ where this page comes from