securityfs_create_dir(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… securityfs_create_dir(9) β€” the Kernel API Manual moment

okay so bestie, welcome to securityfs_create_dir(9) from the Kernel API Manual. yes we're in kernel land. yes there will be dentries. no you cannot just mkdir and go home. let's get into it 🫢


✨ NAME ✨

securityfs_create_dir β€” literally creates a directory inside the securityfs filesystem. that's the whole vibe. iconic behaviour, honestly πŸŽ€


🌸 SYNOPSIS 🌸

struct dentry * securityfs_create_dir (const char *name , struct dentry *parent );

look at her. one pointer in, two args, struct dentry * coming back out. main character signature ngl ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • name β€” a pointer to a string holding the name of the directory you wanna create. just the name. that's it. that's the girl πŸ’…
  • parent β€” a pointer to the parent dentry for this file. bestie, this should be a directory dentry if you set it. and if this parameter is NULL, then your directory gets created in the root of the securityfs filesystem instead. so NULL = "put me at the top, idc" 😌

πŸ‘‘ DESCRIPTION πŸ‘‘

so this function creates a directory in securityfs with the given name. simple. slay. no cap.

this function returns a pointer to a dentry if it succeeds. important part, listen up 🚨: that pointer must be passed to the securityfs_remove function when the file is to be removed. and no β€” there is no automatic cleanup if your module gets unloaded. you are responsible here. you. personally. the accountability is giving very much main character energy 😭

if an error occurs, the function will return the error value (via ERR_PTR). so like, check your returns, bestie, fr fr πŸ™ˆ

lowkey crucial: if securityfs is not enabled in the kernel, the value -ENODEV is returned. so if you're getting -ENODEV and spiralling, that's why πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

go read the whole friend group, they all hang out together 🧚


🌈 the cute sign-off 🌈

this lil page lives at ./security in the source tree, and it's dated October 2026 β€” yes, from the future, we don't ask questions πŸ•°οΈβœ¨ and the header said securityfs_create_dir(9) from the Kernel API Manual, which you already knew because you're a scholar and a genius. periodt. πŸ’–

πŸ“¦ where this page comes from