bpf_path_d_path(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… bpf_path_d_path(9) β€” like, the Kernel API Manual page, bestie πŸŽ€

okay so this is bpf_path_d_path(9) from the Kernel API Manual, and honestly? she's that girl. let's get into it ✨


🌸 NAME 🌸

bpf_path_d_path β€” resolves the pathname for the path you hand her 🫢


⭐ SYNOPSIS ⭐

__bpf_kfunc int bpf_path_d_path (const struct path *path , char *buf ,
size_t buf__sz );

no cap, that's the whole signature. copy it exactly, don't get creative πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • path β€” the path you want the pathname resolved for. she's the main character here πŸ”₯
  • buf β€” the buffer where the resolved pathname gets returned. put it in, she goes there πŸ’–
  • buf__sz β€” the length of the buffer you supplied. yes, the size matters, keep it correct πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

So what she does: she resolves the pathname for the supplied path and stores it in buf. simple, iconic, no drama 🌈

This BPF kfunc is literally the safer variant of the legacy bpf_d_path helper, and you should use it in place of bpf_d_path whenever possible. like, if you can use her, use her. she ate πŸ“

⚠️ big one: this BPF kfunc may only be called from BPF LSM programs. that's the vibe check and she will fail you if you ignore it πŸ’€

πŸ‘‘ RETURN πŸ‘‘

  • On success: a positive integer corresponding to the length of the resolved pathname in buf, including the NUL termination character (yes, the NUL counts, don't forget her ⭐)
  • On error: a negative integer is returned 😭

🧚 SEE ALSO 🧚

Kernel file ./fs/bpf_fs_kfuncs.c, plus her whole friend group:

like, the whole group chat is in here fr fr 🫢


okay that's the whole page, mwah πŸ’‹ this dropped from ./fs back in October 2026, and yep, the page itself is bpf_path_d_path(9) β€” you're so welcome bestie, go resolve those pathnames responsibly βœ¨πŸ’–πŸŽ€

πŸ“¦ where this page comes from