bpf_obj_new(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

bpf_obj_new β€” bestie, this is the one that allocates an object described by program BTF ✨


🌸 SYNOPSIS 🌸

__bpf_kfunc void * bpf_obj_new (u64 local_type_id__k , struct btf_struct_meta *meta );

πŸŽ€ ARGUMENTS πŸŽ€

  • local_type_id__k β€” the type ID, but in program BTF. That's the ID you're feeding in, queen.
  • meta β€” the verifier-supplied struct metadata. The verifier hands this to you, okay? It's a whole thing.

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: you call this bad boy and it allocates an object of the type identified by local_type_id__k, then initializes its special fields. Like, it does the whole glow-up for you πŸ’…

BPF programs can use bpf_core_type_id_local to provide local_type_id__k β€” that's literally the whole trick, iykyk.

And the meta? The verifier rewrites meta. BPF programs do not set it. Nope. Not your job, bestie. Don't touch it πŸ™ˆ


⭐ RETURN ⭐

A pointer to the allocated object, or NULL on failure. That's it, that's the vibe check 😭


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./kernel/bpf/helpers.c, plus the entire friend group:


That's the whole page, bestie 🫢 it lives in ./kernel/bpf, it's dated October 2026, and it slayed the whole way through. Periodt. πŸ‘‘

πŸ“¦ where this page comes from