sysfs_change_owner(9)
π sysfs_change_owner β the kernel API manual, but make it cute
okay bestie, welcome to the Kernel API Manual β¨ this one's a little function with big main-character energy: sysfs_change_owner. It literally changes who owns stuff. slay.
β¨ NAME β¨
sysfs_change_owner β change owner of the given object π
π¦ SYNOPSIS π¦
int sysfs_change_owner (struct kobject *kobj , kuid_t kuid , kgid_t kgid );
that's the whole signature, no cap. three args, one int back. π«Ά
π ARGUMENTS π
kobjβ object. yeah. that's it. the object. the main character of this whole page πkuidβ new owner'skuidπkgidβ new owner'skgidπ
πΈ DESCRIPTION πΈ
So here's the vibe: sysfs_change_owner changes the owner of the default directory, files, groups, and attributes of kobj to kuid/kgid. iconic behaviour, honestly.
and like, the way it does this is mirroring how the sysfs entries for a kobject get added by driver core. in summary (and I'm quoting the vibe here, not adding anything), sysfs_change_owner takes care of:
- the default directory entry for
kobj - the default attributes associated with the
ktypeofkobj - the default attributes associated with the
ktypeofkobjβ and yes bestie, it's listed twice in the source, so we're listing it twice. we don't gatekeep, we don't edit. β¨
ngl though, this is the important part: additional properties not added by driver core have to be changed by the driver or subsystem which created them. so if you made it yourself, you're changing it yourself. periodt. π
and this whole thing is similar to how driver/subsystem specific entries are removed β same energy, matching set. π§
π Returns 0 on success or error code on failure. no in-between, no "sort of worked", it's 0 or it's a whole error code, that's the deal.
π₯ SEE ALSO π₯
go off, related functions β kernel file ./fs/sysfs/file.c and the whole friend group:
sysfs_create_file_ns(9)sysfs_add_file_to_group(9)sysfs_chmod_file(9)sysfs_break_active_protection(9)sysfs_unbreak_active_protection(9)sysfs_remove_file_ns(9)sysfs_remove_file_self(9)sysfs_remove_file_from_group(9)sysfs_create_bin_file(9)sysfs_remove_bin_file(9)sysfs_link_change_owner(9)sysfs_file_change_owner(9)sysfs_emit(9)sysfs_emit_at(9)sysfs_bin_attr_simple_read(9)
okay that's the whole page, you ate it up π mwah. this little icon was served up from ./fs/sysfs, dated October 2026 β remember her πβ¨π·
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms