shmem_file_setup_with_mnt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 shmem_file_setup_with_mnt (9) β€” the kernel API manual, bestie edition πŸŽ€

okay so picture this: you need a file. but not, like, a file file. no directory entry, no name on disk, just a vibe living rent-free in tmpfs. that's literally what this function does and honestly? iconic. it hands you back a struct file * that's already unlinked, chillin' in a tmpfs mount of your choosing. no cap. πŸ’…


✨ NAME ✨

shmem_file_setup_with_mnt β€” get an unlinked file living in tmpfs 🫢


🌈 SYNOPSIS 🌈

struct file * shmem_file_setup_with_mnt (struct vfsmount *mnt , const
       char *name , loff_t size , vma_flags_t flags );

like, that's the whole signature. look at her go. πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • mnt β€” the tmpfs mount where the file will be created. yes, you pick which mount. main character energy fr fr.
  • name β€” name for dentry (to be seen in /proc/<pid>/maps). so it does have a name, it's just for looking pretty in maps, not for finding on disk. iykyk.
  • size β€” size to be set for the file. the number. the whole lewk. πŸ“
  • flags β€” VMA_NORESERVE_BIT suppresses pre-accounting of the entire object size. like, no reserving the whole thing up front, mmkay? πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

the whole shmem friend group!! go read them too, they're all serving. 🌸✨


ngl bestie, this one lives in ./mm, and it's dated October 2026. that's the source/version and date teas, so now you know. mwah πŸ’‹ 🩷
πŸ“¦ where this page comes from