securityfs_create_symlink(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, today's main character is securityfs_create_symlink(9) from the Kernel API Manual β€” and she is literally the girl who makes symlinks inside securityfs. no cap. ✨


πŸŽ€ SYNOPSIS πŸŽ€

struct dentry * securityfs_create_symlink (const char *name , struct
dentry *parent , const char *target , const struct inode_operations
*iops );

like… look at her. four params, one struct dentry * coming back at you. she ate. πŸ’…


🌸 ARGUMENTS 🌸

  • name β€” a pointer to a string holding the name of the symlink you're about to create. that's the label on the door, bestie. πŸšͺ
  • parent β€” a pointer to the parent dentry for the symlink. this should be a directory dentry if you set it. and if this parameter is NULL? then the directory gets created in the root of the securityfs filesystem. so like, NULL = "put it at the top, idc." 🫢
  • target β€” a pointer to a string containing the name of the symlink's target. ⚠️ but heads up: if this parameter is NULL, then the iops parameter needs to be set up to handle .readlink and .get_link inode_operations. it's giving "you have to do the work yourself." 😭
  • iops β€” a pointer to the struct inode_operations to use for the symlink. if this parameter is NULL, then the default simple_symlink_inode operations will be used. easy mode, slay. ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does she actually do? this function creates a symlink in securityfs with the given name. that's it, that's the vibe. 🌈

now the important part, and i need you to actually listen for this one: this function returns a pointer to a dentry if it succeeds. πŸŽ€ that pointer must be passed to the securityfs_remove function when the file is to be removed. like, for real. there is no automatic cleanup that happens if your module is unloaded β€” you are responsible here. no one is coming to save you, bestie. πŸ’€πŸ˜­

if an error occurs, the function will return the error value (via ERR_PTR). so, y'know, vibe check your return value before you dereference it. πŸ™ˆ

and if securityfs is not enabled in the kernel? the value -ENODEV is returned. iconic of her honestly. πŸ‘‘


🌟 SEE ALSO 🌟


and that's the whole page, bestie!! 🫢✨ this lil gem comes from the source ./security, dated October 2026, in the Kernel API Manual β€” go forth and symlink responsibly. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from