bpf_refcount_acquire(9)
π 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
bpf_obj_new(9)bpf_percpu_obj_new(9)bpf_obj_drop(9)bpf_percpu_obj_drop(9)bpf_list_push_front(9)bpf_list_push_back(9)bpf_rbtree_add(9)bpf_task_acquire(9)bpf_task_release(9)bpf_cgroup_acquire(9)bpf_cgroup_release(9)bpf_cgroup_ancestor(9)bpf_cgroup_from_id(9)bpf_task_under_cgroup(9)bpf_task_get_cgroup1(9)bpf_task_from_pid(9)bpf_task_from_vpid(9)bpf_dynptr_slice(9)bpf_dynptr_slice_rdwr(9)bpf_dynptr_copy(9)bpf_dynptr_memset(9)bpf_iter_bits_new(9)bpf_iter_bits_next(9)bpf_iter_bits_destroy(9)bpf_copy_from_user_str(9)bpf_copy_from_user_task_str(9)bpf_strcmp(9)bpf_strcasecmp(9)bpf_strnchr(9)bpf_strchr(9)bpf_strchrnul(9)bpf_strrchr(9)bpf_strnlen(9)bpf_strlen(9)bpf_strspn(9)bpf_strcspn(9)bpf_strstr(9)bpf_strcasestr(9)bpf_strnstr(9)bpf_strncasestr(9)bpf_lookup_user_key(9)bpf_lookup_system_key(9)bpf_key_put(9)bpf_verify_pkcs7_signature(9)bpf_task_work_schedule_signal(9)bpf_task_work_schedule_resume(9)bpf_timer_cancel_async(9)
π 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms