file_ns_capable(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… file_ns_capable(9) πŸ’…

okay so picture this: you're deep in the kernel source, it's 2am, and you stumble on file_ns_capable from the Kernel API Manual (that's the manual name bestie, write it down) and you're like "what does this even do". don't worry. i got you. 🫢


✨ NAME ✨

file_ns_capable β€” literally figures out whether the person who opened a file had a capability in effect. that's it. that's the whole vibe check. πŸŽ€


🌸 SYNOPSIS 🌸

bool file_ns_capable (const struct file *file , struct user_namespace *ns , int cap );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • file β€” the file we wanna check, bestie. the one in question. our main character file. πŸ‘‘
  • ns β€” the usernamespace where we want that capability to be checked. different namespace, different rules, iykyk. 🌈
  • cap β€” the actual capability we're testing for. like, which permission are we sniffing around for. πŸ”

πŸ’– DESCRIPTION πŸ’–

returns true if the task that opened the file had a capability in effect back when the file was opened. past tense. historical record. we're not asking "do you have it now", we're asking "did you have it then". πŸ’…

and no, it does not set PF_SUPERPRIV, because lowkey the caller may not actually be privileged at all. so we're not out here stamping "privileged" on people who aren't. that would be messy and we don't do messy. πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

like, the whole capability friend group. they all show up to the same party. slay. πŸ’€βœ¨


and that's the page!! mwah πŸ’‹

sign-off time: this lil masterpiece lives in ./kernel, it's the Kernel API Manual, and it's dated October 2026. periodt. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from