sysfs_link_change_owner(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

Hey bestie, welcome to the sysfs_link_change_owner(9) page β€” yes, that's the kernel API manual, and yes, we're about to make symlink ownership make sense. Sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

sysfs_link_change_owner β€” change owner of a sysfs file. That's the whole vibe. 🫢


🌸 SYNOPSIS 🌸

int sysfs_link_change_owner (struct kobject *kobj , struct kobject *targ
, const char *name , kuid_t kuid , kgid_t kgid );

Like, five whole arguments. Not me being obsessed with a function signature 😭 but here we are.


πŸŽ€ ARGUMENTS πŸŽ€

  • kobj β€” the object of the kernfs_node the symlink is located in. Think of it as: where the link physically lives, bestie 🏠
  • targ β€” the object of the kernfs_node the symlink points to. This is the destination the link is doing its little pointy thing at πŸ‘‰
  • name β€” name of the link. Literally just the name. Iconic, no notes.
  • kuid β€” new owner's kuid. The fresh uid, slay πŸ‘‘
  • kgid β€” new owner's kgid. The fresh gid to match, periodt πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, what does this bad boy actually do? It looks up the sysfs symlink entry name under kobj, and changes the ownership to kuid/kgid. The way it does the lookup is in the namespace of targ β€” important detail, don't sleep on it πŸ’–

Returns 0 on success or an error code on failure. That's it, that's the whole story. Clean, simple, main character energy ✨

Heads up bestie: failure means you get an error code back, not 0. Always check the return value, fr fr πŸ”₯

🌈 SEE ALSO 🌈

Kernel file ./fs/sysfs/file.c, plus the whole friend group:

Every single one of them, no cap. Go read them too, iykyk πŸ“š


That's the page, bestie! 🧚 This little gem lives at ./fs/sysfs, and it's dated October 2026 in the Kernel API Manual. Mwah, go change some owners responsibly πŸ’œ

πŸ“¦ where this page comes from